How to select all after URI segment 2 in codeignit

2019-09-12 02:24发布

I encoded some data and sent it through url as $this->uri->segment(2) and encoded string contains '/' and other symbols. I can not select full URI segment because of those '/' signs. My main question is, how to select in controller everything after URI segment 1?

$enc_session_email = $this->encrypt->encode($this->session->userdata('email'));

and I get the url result:

http://localhost/ci/new-affilate/YWwfV9KJrOiY+J08WUcufZkmKbW5ST7wTp+bofnRP35bv/gzvA+5fYo7J6jDCvt0NwzMiEFdU2r3+a8+scqLTA==

How to get all after new-affilate in controller?

2条回答
仙女界的扛把子
2楼-- · 2019-09-12 03:12

You have to make your URL like this:

http://localhost/ci/new-affilate?enc_session_email=$enc_session_email

and then get it like this:

$enc_session_email = $this->input->get('enc_session_email', TRUE);
查看更多
Anthone
3楼-- · 2019-09-12 03:19

I think this would be suficient:

$encoded_string = ltrim($this->uri->ruri_string(), $this->uri->slash_rsegment(1, 'trailing'));
查看更多
登录 后发表回答