Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one access the URL arguments in codeigniter if one was to follow REST architecture?

The following is a valid REST based URL that can be used to access a resource:

Using codeigniter, how can one access the parameter of 1 that was passed below.

enter image description here

I saw the above in a tutorial and have set up my code. However obviously:

 $id = $this->input->get('id');

does not work.

like image 380
jini Avatar asked Sep 05 '11 05:09

jini


1 Answers

Using $this->input->get('id') would suggest you are sending ?id=1 to the end of the URL. You can use $this->uri->segment(1) but that does not allow for paired uri segments.

If you use $this->get('id') which is a special REST_Controller method then it will pick up either. I did put that in the tutorial you got this image from :)

like image 172
Phil Sturgeon Avatar answered Sep 18 '22 22:09

Phil Sturgeon