Posts

Showing posts from May, 2016

how to route the URI with parameters to a method in codeigniter?

In CI 3.x the (:any) parameter matches only a single URI segment. So for example: $route['method/(:any)/(:any)']='controller/method/$1/$2'; will match exactly two segments and pass them appropriately. If you want to match 1 or 2 you can do this (in order): $route['method/(:any)/(:any)']='controller/method/$1/$2'; $route['method/(:any)']='controller/method/$1'; You can pass multiple segments with the (.+) parameter like this: $route['method/(.+)']='controller/method/$1'; For more info visit stackoverflow