Reputation: 1945
How would you map the following route using Codeigniter 3?
/companies/{id}/surveys/{id}/users/{id}
As far as I can tell (by reading the docs), only 1 id can be sent to a Controller method. Thanks in advance.
Upvotes: 1
Views: 210
Reputation: 5398
no matter how many parameters are in your URL. All you have to do is specify your parameter by using $1
, $2
respectively for 1st
and then 2nd
parameter and so on. example
$route['companies/(:num)/surveys/(:num)/users/(:num)'] = 'company/stat/$1/$2/$3';
here http://localhost/your_project/companies/1/surveys/3/users/32
will goes to company
controller then stat
method with 1
, 3
and 32
parameters
hope its helps
Upvotes: 1