我的本地主机(localhost/supplies/)中有一个应用程序,并且在 routes.php 文件中指定了默认控制器。
$route['default_controller'] = "start";
问题是当我想在 URL 为“localhost/supplies/admin/”或“localhost/supplies/admin”时加载或执行控制器。
我做了测试
$route['admin'] = "controllers/admin";
但它不起作用。
我的本地主机(localhost/supplies/)中有一个应用程序,并且在 routes.php 文件中指定了默认控制器。
$route['default_controller'] = "start";
问题是当我想在 URL 为“localhost/supplies/admin/”或“localhost/supplies/admin”时加载或执行控制器。
我做了测试
$route['admin'] = "controllers/admin";
但它不起作用。
只需使用
$route['admin'] = "admin/yourcontrollerName";
If your application root is in localhost/supplies
there is no reason to route that.
URL localhost/supplies/admin
will call the admin
controller without need for any routing.
(Works if you omitted index.php from the URL.)
Your suggested routing would call the method admin
in the controller named controller