开发者

Routing and URI parsing in Codeigniter

I have a route defined in CI,

$route['user/activate-account/:any'] = "user/activate_account";

People access the route in this url pattern,

http://mydomain.com/user/activate-account/user_id/12345/token/abcdefghijk

Inside the activate_account function, I tried to use the following codes to retrieve the required data,

$user_id=$this->input->get('user_id');
$token=$this->input->get('token');

But they return FALSE, does this mean that for this开发者_高级运维 kind of url pattern, I am supposed to use the functions provided by the URI class (http://codeigniter.com/user_guide/libraries/uri.html) to retrieve the variables?


Since your url is re-routed, you would need to use:

$usre_id = $this->uri->rsegment(n);

Check out docs for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜