路由到CodeIgniter中的多个子文件夹 [英] Route to multiple sub folders in CodeIgniter
本文介绍了路由到CodeIgniter中的多个子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个管理文件夹设置在我的控制器目录下,我有3个单独的子文件夹,其中包含控制器。
- 控制器
---- Admin
------仪表板
-------- dashboard.php
---- ---- file.php
------成员
-------- members.php
-------- file.php
------设置
-------- settings.php
-------- file.php
我尝试在routes.php文件中路由它
$ route ['admin /(:any)/(:any)'] ='admin / $ 1 / $ 2';
$ route ['admin /(:any)'] ='admin / $ 1 / $ 1';
$ route ['admin'] ='admin / index';
我该如何解决这个问题?
解决方案开箱即用代码指示器不支持控制器目录中的多个子目录级别,只有一个。
I have a admin folder set up in my controllers directory, under that i have 3 seperate sub-folders with controllers inside of them.
-- Controllers ---- Admin ------ Dashboard -------- dashboard.php -------- file.php ------ Members -------- members.php -------- file.php ------ Settings -------- settings.php -------- file.php
I tried routing it in the routes.php file like this
$route['admin/(:any)/(:any)'] = 'admin/$1/$2'; $route['admin/(:any)'] = 'admin/$1/$1'; $route['admin'] = 'admin/index';
What do I do to fix this?
解决方案"Out of the Box" codeigniter does not support multiple subdirectory levels in your controllers directory, just one.
There is a way to extend the routing class to support this, check this blog entry.
这篇关于路由到CodeIgniter中的多个子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文