Codeigniter 无法识别base_url()
特定控制器上的 a,即使它适用于其他控制器并且 URL 帮助程序已自动加载。这导致受影响的控制器显示 HTML,但不显示 CSS 和 JS 等必要资产。
假设故障控制器的视图应该显示http://localhost/sub/app/assets/css/style.css
在 HTML 上以正确加载样式表,但相反,它显示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 */
我会在您需要时提供更多详细信息。
谢谢!