简体   繁体   English

Codeigniter中的动态路由

[英]Dynamic routes in codeigniter

How to write custom routes in codeigniter? 如何在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. 除了您在做什么,您还可以在codeigniter中使用slug概念来创建动态路由。 Check this link. 检查此链接。 http://osvaldas.info/smart-database-driven-routing-in-codeigniter http://osvaldas.info/smart-database-driven-routing-in-codeigniter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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