【发布时间】:2014-11-10 12:07:23
【问题描述】:
我已经为admin 和front-end 创建了两个单独的控制器,我可以访问前端控制器并可以访问它的功能,但是当我尝试访问管理控制器时,我无法使用.htacess文件来重写url。我的url看起来像http://localhost/bookstore/index。
前端控制器:
<?php
class Bookstore extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper(array('url','form','file','cookie','captcha'));
$this->load->library(array('session','pagination','form_validation'));
$this->load->model('bkmodel');
}
public function index()
{
$this->load->view('index');
}
}
管理员-控制器:
class Adminstore extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper(array('url','form','file','cookie','captcha'));
$this->load->library(array('session','pagination','form_validation'));
$this->load->model('admin_model');
}
public function index()
{
$this->load->view('admin/index');
}
}
路由文件如下所示:
$route['default_controller'] = "bookstore";
$route['(:any)'] = "bookstore/$1";
$route['404_override'] = '';
我被困在这里,为什么第二个控制器不工作,请指出我的错误,这样当我想访问管理员时,我可以再处理一件事,我的网址是这样的http://localhost/bookstore/adminstore/index,它说找不到 404 页面
【问题讨论】: