Reputation: 2332
I am using CodeIgniter, and I am new to it. I came to know that I can pass parameters to another page like http://example.com/users/list/param1/param2/param3/.... and so on.
Now on the destination php script, I can get it as $this->uri->segment(2) , but I must know that which location it is in the uri. Say I am getting param2 , I must know that it is uri segment 4. This is a great pain for me. I previously worked with ZEND , where we send parameters like http://examples.com/controller/action/key/value/key/value , Now in this case I can always dynamic number of parameters and I don't need to know their location in the uri, but I just need to know the key.
Qestion : Is there a way where I can pass parameters using GET in key-value pairs in codeigniter, like the one ZEND do?
Upvotes: 2
Views: 1646
Reputation: 19738
Take a look at the function $this->uri->uri_to_assoc(n)
in the URI
class. It will take in your url segments as an associative array. You could then check whether the keys are present in it or not.
Example and full explanation in the user guide.
Upvotes: 1