【发布时间】:2017-07-06 14:14:06
【问题描述】:
说我有这个网址
http://localhost/newtkt/index.php/welcome/gettkt/PfIfiETYXzUpYRJf6RPvyncN4PgdN3
还有一个控制器功能
public function gettkt()
{
//mydata
}
如何检索 url 附带的参数 PfIfiETYXzUpYRJf6RPvyncN4PgdN3 并使其成为我的控制器函数 gettkt() 中的变量,以便我可以在函数中使用参数,如 gettkt(thisparameter)。我希望我以最好的方式组织了我的问题。谢谢。
【问题讨论】:
-
尝试
$this->request->param或使用$this->input->get()或$this->uri->segment('3');其中 3 代表第三个参数 -
我收到错误
Undefined property: Welcome::$request -
使用
$this->input->get()或$this->uri->segment('3');其中3是3rd参数 -
是的,它现在与
$this->uri->segment('3');合作 -
非常感谢@urfusion
标签: php ajax codeigniter get