Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter扩展核心异常类函数问题_Php_Codeigniter - Fatal编程技术网

Php 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

我扩展了codeigniter本机库(异常),并定义了一个新函数

这是代码

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)