在链接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