Create routes with multiple parameters in CodeIgniter

0

I have a project developed in Codeigniter and I'm setting up some routes to get some nice URLs, but I ended up finding a problem.

In a certain route, I do not know how many parameters it will come, it may come with 1 parameter or even with 4 parameters. In the routes.php file, how would I configure to recognize these parameters?

This example works, but I do not think it's the right one:

$route['vendas/(:any)'] = '$1';
$route['vendas/(:any)/(:any)'] = '$1/$2';
$route['vendas/(:any)/(:any)/(:any)'] = '$1/$2/$3';
$route['vendas/(:any)/(:any)/(:any)/(:any)'] = '$1/$2/$3/$4';
    
asked by anonymous 25.06.2018 / 20:23

0 answers