How to achieve /index.php/myapp?id=1
in codeigniter format like
/index.php/myapp/id/1
But the above doesn't work
Thanks!
UPDATE per comment:
URL=/index.php/myapp/show/1
function show(){ $data=$this->input->get(); }
CodeIgniter uses controllers and URL segments to achieve this. With URI Class you will be able to access the ID with $this->uri->segment(3)
.
You can remove /id/
from your address and make a kind of RESTful scheme that will redirect /:any/:num
to /:any/show/:num
. This way, you'll just have to create a show
method in your controller to get the ID and process it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.