嗨因为某些原因我的路线上没有为我的管理路线选择第三级文件夹。我一直在阅读用户指南,但还不太确定。
错误:找不到您请求的页面。
控制器
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);
}
}
答案 0 :(得分:0)
这可以帮助你:
您的配置:(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
如果您希望将页面添加到管理控制器,请确保在视图文件夹中添加所需文件。
编辑:我注意到你正在使用数据加载我更新的页眉/页脚并重新添加。