【发布时间】:2012-02-11 07:45:29
【问题描述】:
所以基本上,以下是我现在拥有的代码:
class MY_Log extends CI_Log {
/**
* Variable storing the CodeIgniter instance.
*
* @access private
* @since v0.1.0.0
*/
private $CI;
/**
* Constructor for later use by internal
* methods.
*
* @access public
* @since v0.1.0.0
*/
public function __construct()
{
// Extend the parent logging.
parent::__construct();
$this->$CI =& get_instance();
}
}
我收到以下错误;
Fatal error: Class 'CI_Controller' not found in /<deleted>/system/core/CodeIgniter.php on line 233
用户指南是这样描述的。
【问题讨论】:
-
你的文件系统中是否有 system/core/Controller.php 文件?
-
是的,第233行是:return CI_Controller::get_instance();
-
我自己没有尝试过,但是您确定需要执行 get_instance 吗?在我一次尝试扩展 CI_Controller 时,我似乎可以通过 $this 访问 CI 对象(即 $this->load->vars($data); 现成可用)
-
我收到“未定义的属性:MY_Log::$load”。愚蠢的图书馆有时让我发疯。
标签: php codeigniter extend