Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在链接php codeigniter中获取参数_Php_Ajax_Codeigniter_Get - Fatal编程技术网

在链接php codeigniter中获取参数

在链接php codeigniter中获取参数,php,ajax,codeigniter,get,Php,Ajax,Codeigniter,Get,假设我有这个网址 http://localhost/newtkt/index.php/welcome/gettkt/PfIfiETYXzUpYRJf6RPvyncN4PgdN3 和控制器功能 public function gettkt() { //mydata } 如何检索url随附的参数PfIfiETYXzUpYRJf6RPvyncN4PgdN3,并将其作为控制器函数gettkt()中的变量,以便在函数中使用该参数,如gettkt(thisparameter)。我希望我的问题结构尽可

假设我有这个网址

http://localhost/newtkt/index.php/welcome/gettkt/PfIfiETYXzUpYRJf6RPvyncN4PgdN3
和控制器功能

public function gettkt()
{
  //mydata
}
如何检索url随附的参数
PfIfiETYXzUpYRJf6RPvyncN4PgdN3
,并将其作为控制器函数
gettkt()
中的变量,以便在函数中使用该参数,如
gettkt(thisparameter)
。我希望我的问题结构尽可能好。谢谢。

你可以做两件事

方法01

public function gettkt($parm)
{
    echo $parm; # Prints PfIfiETYXzUpYRJf6RPvyncN4PgdN3
}
方法02

在点火器中的应用

$parm = $this->uri->segment(n); # Number point your parameter 
$parm = $this->uri->segment(3); # Prints PfIfiETYXzUpYRJf6RPvyncN4PgdN3
你可以做两件事

方法01

public function gettkt($parm)
{
    echo $parm; # Prints PfIfiETYXzUpYRJf6RPvyncN4PgdN3
}
方法02

在点火器中的应用

$parm = $this->uri->segment(n); # Number point your parameter 
$parm = $this->uri->segment(3); # Prints PfIfiETYXzUpYRJf6RPvyncN4PgdN3
你可以用

$this->uri->segment('3'); //where 3 is for 3rd param
有关更多信息,请访问,您可以使用

$this->uri->segment('3'); //where 3 is for 3rd param

有关更多信息,请访问尝试
$this->request->param
或使用
$this->input->get()
$this->uri->segment('3')
其中3表示第三个参数get error
未定义属性:欢迎:$request
使用
$this->input->get()
$this->uri->segment('3')
其中
3
表示
3rd
参数,它现在使用
$this->uri->segment('3')
非常感谢@urfusionry
$this->request->param
或使用
$this->input->get()
$this->uri->segment('3')
其中3表示第三个参数get error
未定义属性:欢迎:$request
使用
$this->input->get()
$this->uri->segment('3')
其中
3
表示
3rd
参数,它现在使用
$this->uri->segment('3')非常感谢@urfusion