result I want :
greeting/102/steve => greeting/index/102/steve
in greeting.php :
function index($order,$name)
{
echo "order: $order , name : $name ! ";
}
in route.php :
$route['greeting/(:num)/(:any)'] = "greeting/index/$1/$2";
result I get :
order : , name : steve !
Actually, it's right to use double quotes. It's even indicated like this in the manual (beside having done it a hundred times), so I don't see the problem @cwallenpool is pointing out.
Your routing looks fine, be sure it is called after the reserved routes
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['greeting/(:num)/(:any)'] = "greeting/index/$1/$2";
.
I suggest you to try using $this->uri->rsegment(n) (info on user guide here) to catch the rerouted uri segment that's causing you trouble. (similar to $this->uri->segment(n) but designed specifically for rerouted URIs)
You can also try changing the $config['uri_protocol'] from AUTO to PATH_INFO (or one of the other alternatives) and see if the problem doesn't sit there. Remember also to delete the 'index.php' part in $config['index_page'] if you're using htaccess to delete the index.php from you URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With