我正在尝试扩展CI_Loader
类以覆盖_ci_load_library()
,但我收到:
Fatal error: Class 'CI_Loader' not found in C:\Users\X\workspace\ci-app\application\core\MY_Loader.php on line 4
A PHP Error was encountered
Severity: Error
Message: Class 'CI_Loader' not found
Filename: core/MY_Loader.php
Line Number: 4
Backtrace:
类MY_Loader
位于application/core/MY_Loader.php
中,就像这样:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class MY_Loader extends CI_Loader
{
public function __construct()
{
parent::__construct();
}
protected function _ci_load_library($class, $params = NULL, $object_name = NULL)
{
// ...
}
}
我正在使用最新版本的CodeIgniter: 3.1.9
答案 0 :(得分:1)
尝试在类MY_Loader的声明上方添加以下行
require APPPATH."../system/core/Loader.php";