简体   繁体   中英

Dynamic routes in codeigniter

How to write custom routes in codeigniter?

$route['codeigniter/getAllCategories'] = "codeigniter/category_controller/getAllCategories";
$route['default_controller'] = "admin";
$route['404_override'] = '';
http://localhost/codeigniter/category_controller/getAllCategories
$route['(:any)/(:any)'] = 'category_controller/$1/$2';

Instead of what you are doing , you can do the concept of slug in codeigniter to create dynamic routes. Check this link. http://osvaldas.info/smart-database-driven-routing-in-codeigniter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM