Codeigniter - 在我有默认控制器设置时无法访问控制器

时间:2012-01-23 18:45:48

标签: php codeigniter frameworks controller routes

我在同一个文件夹中有两个控制器。一个是命名标准,一个名为reviewApprove。他们的代码是相同的(除了类名)。

如果我将条件设置为路由中的默认控制器,那么我可以访问它,但无论我无法导航到reviewApprove控制器。

如果我没有设置默认控制器并导航到index.php / reviewApprove或index.php / criteria ..那就可以了。

如果我将reviewApprove设置为默认控制器,我也可以看到它。

我的htaccess文件已设置。我将我的项目与其他一些代码点火器项目进行了比较,但无法分辨出我做错了什么。

有人有什么想法吗?

标准控制器

class Criteria extends APN_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->vars(array('nav' => array('','', 'current', '', '')));
    }


public function index(){

        $this->_set('title', "Certified Analytics");
        $this->_set('js', "/resources/authenticated/js/coverage");
        $this->_set('css', "/resources/authenticated/css/enroll"); 
        $this->load->view('authenticated/header/header', $this->_data);
        $this->load->view('authenticated/content/coverage');
        $this->load->view('authenticated/footer/footer');

}
}

reviewApprove controller

class ReviewApprove extends APN_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->vars(array('nav' => array('','current', '', '', '')));
    }


public function index(){

        $this->_set('title', "Certified Analytics");
        $this->_set('js', "/resources/authenticated/js/criteria");
        $this->_set('css', "/resources/authenticated/css/enroll"); 
        $this->load->view('authenticated/header/header', $this->_data);
        $this->load->view('authenticated/content/reviewApprove');
        $this->load->view('authenticated/footer/footer');

}
}

路由

$route['default_controller'] = "criteria";

htaccess的

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /certifiedAnalytics/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule> 

还有什么必要吗?

0 个答案:

没有答案