开发者

Codeigniter: how to access controllers in ‘admin’ directory

开发者 https://www.devze.com 2023-02-12 10:31 出处:网络
I have created an admin folder in controllers folder. I have created a controller user in controllers/admin folder.

I have created an admin folder in controllers folder. I have created a controller user in controllers/admin folder.

The foll开发者_JS百科owing line was added to routes.php:

$route[‘admin/(:any)’] = ‘admin/([a-zA-Z0-9/_]+)’;

The following url is used to access the user controller in controllers/admin folder.

http://localhost/main/forum/admin/user/

My application is routed to default controller and my urls are containing variable like as follows:

http://localhost/main/forum/admin/user/view
http://localhost/main/forum/admin/user/create
http://localhost/main/forum/admin/user/delete/uid/1/uname/my_name
http://localhost/main/forum/admin/dashboard/first_var/2/second_var/3/third_var/4

Thanks in advance.

Also posted on the CodeIgniter forums: Code Igniter forum link


If you're installation is in the forum directory, then what you are doing is right. In fact, you don't need routes.

Simply going to your_app_installation/admin/user would point to your_app_installation/admin/user.

0

精彩评论

暂无评论...
验证码 换一张
取 消