我的 Codeigniter 2.1.0 应用程序中有这个错误控制器:
<?php
class Error extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "404 error !";
$data->pageview = 'templates/404';
$this->load->view('templates/main', $data);
}
public function facebook()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "Facebook error !";
$data->pageview = "templates/facebook_error";
$this->load->view('templates/main', $data);
}
}
?>
主控制器 _menu:
<?php
class Main extends CI_Controller
{
// ... a lot of methods here ...
public static function _menu()
{
static $menuItems = array( //just a simple array
);
}
}
?>
facebook() 方法与 index() 完全一样,但是 index 工作正常,facebook() 抛出这个消息:
Fatal error: Class 'Main' not found in /var/www/MYApplicationName/application/controllers/error.php on line 22
地球怎么可能?我怎样才能Main::_menu()
从 facebook() 方法到达?