I got stack on this in Codeigniter route, What do I want is to remo开发者_如何学Gove the function_name in url to be able to have a short url.
Here is the example want to have in my url
http://mysite.com/controller_name/function_name/id
to this
http://mysite.com/controller_name/id
Is there any other solution to have this if cannot be done in route? thanks!
If the above didn't work you could try:
$route['controller_name/(:num)'] = 'controller_name/lookup_function/$1';
Not much different from what was already suggested other than a hard coded controller name.
You can probably do it by trying:
$route['([a-z]+)/(\d+)'] = "$1/method/$2";
That is if you don't need to change the name of your method.
精彩评论