Php Codeigniter扩展核心异常类函数问题
我扩展了codeigniter本机库(异常),并定义了一个新函数 这是代码Php Codeigniter扩展核心异常类函数问题,php,codeigniter,Php,Codeigniter,我扩展了codeigniter本机库(异常),并定义了一个新函数 这是代码 class MY_Exceptions extends CI_Exceptions { public function __construct() { parent::__construct(); } public function show_error($heading, $message, $template = 'error_general', $status_code
class MY_Exceptions extends CI_Exceptions {
public function __construct() {
parent::__construct();
}
public function show_error($heading, $message, $template = 'error_general', $status_code = 500) {
try {
} catch (Exception $e) {
}
}
public function custom_errors($id, $message) {
try {
//some code here
} catch (Exception $e) {
}
}
}
我将上述类放在application/core/My_Exceptions.php
中,以便自动加载,如文档中所述
问题是,我无法访问控制器中的函数custom\u errors($id,$message)
,而show\u error()
在同一控制器中可用
我试着这样做
$this->my_exceptions->custom_errors($id, $message)
及
但获取此错误“对非对象调用成员函数custom_errors()”
如果codeigniter自动加载,则应在此处提供
请帮助我我做错了什么?为什么不把库放在应用程序文件夹中,不需要自动加载它,这将合并到基类中,只需加载基类..我正在重写基类函数。因此必须将application/core/放入自动加载。
$this->exceptions->custom_errors($id, $message)