【发布时间】:2018-01-05 20:21:52
【问题描述】:
我在 Codeigniter 项目中有两个应用程序。下面是结构:
/admin
/index.php
/application
/admin
/controllers
/Dashboard
/Product
/Post
/public
/controllers
/Home
/About
/Contact
/system
/index.php
公共应用程序可以正常工作。我可以使用此设置调用所有控制器:
/*----seting in /index.php---*/
$application_folder = 'application/public';
/*----seting in /application/public/config/config.php---*/
$config['base_url'] = 'http://localhost/myweb/';
/*----seting in /application/admin/config/routes.php---*/
$route['default_controller'] = 'Home';
但是,Admin 应用程序无法正常工作。我只能调用仪表板控制器,这是我设置的默认控制器。设置如下所示:
/*----setting in /admin/index.php---*/
$application_folder = '../application/admin';
/*----seting in /application/admin/config/config.php---*/
$config['base_url'] = 'http://localhost/myweb/admin/';
/*----seting in /application/admin/config/routes.php---*/
$route['default_controller'] = 'Dashboard';
所以,当我访问时:
http://localhost/myweb/ //it will return home page
http://localhost/myweb/admin //it will return dashboard page
http://localhost/myweb/admin/product //it will return error
谁能帮我解决这个问题?
【问题讨论】:
-
这个链接可能对link有帮助
-
您是否在两者中都复制了索引? @bagongpct
-
您好 ankit,我按照您在上面给我的链接中的说明进行操作。我被复制 index.php 到 /admin/index/php
-
您还需要设置路由来识别包含
admin/的url,并将其重定向到应用程序文件夹中的管理文件夹
标签: php codeigniter codeigniter-3