base_url不能在Codeigniter控制器上工作

时间:2013-05-08 18:04:57

标签: codeigniter

Codeigniter无法识别特定控制器上的base_url(),即使它适用于其他控制器并且URL助手已自动加载。这会导致受影响的控制器显示HTML,但不会显示CSS和JS等必要的资源。

假设glitched控制器的视图应在HTML上显示http://localhost/sub/app/assets/css/style.css以正确加载样式表,而是显示http://localhost/sub/app/controller/method/assets/css/style.css

以下是日志必须说明的内容。

对于那个特殊的故障控制器:

DEBUG - 2013-05-08 18:02:18 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:18 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:19 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:19 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:19 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:19 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:19 --> File loaded: bulletin/views/fragments/header.php
DEBUG - 2013-05-08 18:02:19 --> File loaded: bulletin/views/fragments/navbar.php
DEBUG - 2013-05-08 18:02:19 --> File loaded: bulletin/views/manage/site-sidebar.php
DEBUG - 2013-05-08 18:02:19 --> File loaded: bulletin/views/fragments/footer.php
DEBUG - 2013-05-08 18:02:19 --> File loaded: bulletin/views/manage/site.php
DEBUG - 2013-05-08 18:02:19 --> Final output sent to browser
DEBUG - 2013-05-08 18:02:19 --> Total execution time: 0.4196
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Config Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> URI Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Router Class Initialized
DEBUG - 2013-05-08 18:02:19 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Output Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Security Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Input Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:20 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: html_helper
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:20 --> Controller Class Initialized
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets
ERROR - 2013-05-08 18:02:20 --> 404 Page Not Found --> manage/assets

这是工作控制器的日志:

DEBUG - 2013-05-08 18:01:59 --> Config Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Hooks Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Utf8 Class Initialized
DEBUG - 2013-05-08 18:01:59 --> UTF-8 Support Enabled
DEBUG - 2013-05-08 18:01:59 --> URI Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Router Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Output Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Security Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Input Class Initialized
DEBUG - 2013-05-08 18:01:59 --> Global POST and COOKIE data sanitized
DEBUG - 2013-05-08 18:01:59 --> Language Class Initialized
DEBUG - 2013-05-08 18:02:00 --> Loader Class Initialized
DEBUG - 2013-05-08 18:02:00 --> Config file loaded: bulletin/config/config.php
DEBUG - 2013-05-08 18:02:00 --> Helper loaded: html_helper
DEBUG - 2013-05-08 18:02:00 --> Helper loaded: url_helper
DEBUG - 2013-05-08 18:02:00 --> Controller Class Initialized
DEBUG - 2013-05-08 18:02:00 --> File loaded: bulletin/views/fragments/header.php
DEBUG - 2013-05-08 18:02:00 --> File loaded: bulletin/views/fragments/navbar.php
DEBUG - 2013-05-08 18:02:00 --> File loaded: bulletin/views/fragments/breadcrumb.php
DEBUG - 2013-05-08 18:02:00 --> File loaded: bulletin/views/fragments/footer.php
DEBUG - 2013-05-08 18:02:00 --> File loaded: bulletin/views/dashboard.php
DEBUG - 2013-05-08 18:02:00 --> Final output sent to browser
DEBUG - 2013-05-08 18:02:00 --> Total execution time: 0.4465

更新:这是毛刺控制器:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Manage extends CI_Controller {

    public function site($section = '')
    {
        if($section == 'general')
            redirect('/manage/site','refresh');
        elseif (!empty($section))
            $this->load->view('manage/site-'.$section);
        else
            $this->load->view('manage/site');
    }

}

/* End of file manage.php */
/* Location: ./app/bulletin/controllers/manage.php */

我会根据您的需要提供更多详细信息。

谢谢!

0 个答案:

没有答案