user2565968
user2565968

Reputation:

URL Codeigniter - pass a string

I want to specify the routing rule for URL /responder/1/type/2/category/3/..., that in controller i could get string /responder/1/type/2/category/3/... and cut this string:

[0] = responder;
[1] = 1;
[2] = type;
[3] = 2;

and .etc. The amount of URL settings can be infinite

Upvotes: 0

Views: 623

Answers (1)

keithhatfield
keithhatfield

Reputation: 3273

It sounds like you're looking for the URI class: http://ellislab.com/codeigniter/user-guide/libraries/uri.html

You can get the URL segments as an array by calling the segment_array() method in your controller:

//get the URI segments
$segments = $this->uri->segment_array();

Upvotes: 1

Related Questions