嗨,由于某些原因,在我的路由上,它没有为我的管理路由选择三级文件夹。我一直在阅读用户指南,但还不太确定。
错误:找不到您请求的页面
控制器
admin >
admin > common >
admin > common > header.php
admin > common > footer.php
admin > common > home.php <!-- need route to go here can not find page
路由
$route['default_controller'] = "admin/common/home";
$route['admin/common/home'] = "Administration";
$route['404_override'] = '';
我看了一下这里不确定?https://www.codeigniter.com/user_guide/general/routing.html
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
// Your own constructor code
}
public function index() {
$this->data['header'] = $this->load->view('admin/common/header', NULL, TRUE);
$this->data['footer'] = $this->load->view('admin/common/footer', NULL, TRUE);
$this->load->view('admin/common/home', $this->data);
}
}
这应该会帮助您:
您的配置:(config/routes.php)
$route['default_controller'] = "admin/common/home";
$route['404_override'] = '';
您的控制器应该是:(application/controllers/admin.php)
class Admin extends CI_Controller {
public function __construct() {
parent::__construct();
// Your own constructor code
}
public function index() {
$this->data['header'] = $this->load->view('admin/common/header', NULL, TRUE);
$this->data['footer'] = $this->load->view('admin/common/footer', NULL, TRUE);
$this->load->view('admin/common/home', $this->data);
}
}
现在在您的视图文件夹中,您需要有一个具有以下结构的管理文件夹:
admin
admin/common
- header.php
- home.php
- footer.php
如果您希望将页面添加到管理控制器,请确保在视图文件夹中添加所需的文件。
编辑:我注意到你正在使用数据加载我更新并重新添加的页眉/页脚。