0

所以我已经通过stackoverflow一次或大约十亿次试图找到我的问题的答案,但到目前为止我没有成功。他是问题。我正在使用 trigger_error 调用错误处理类的方法。无论出于何种原因,错误都会在没有调用我定义的函数的情况下触发。请帮忙。这是我的代码

class runtime_errors
{
    public function __construct()
    {
        //  Calling required files
        include_once(ROOT."/inc/php/pac/browser_detect.php");
        include_once(ROOT."/inc/php/func/display_as.php");

        //  Setting needed class functions
        $this->browser      =   new BrowserDetection();
        $this->display_as   =   new display_as();

        //  if available we're going to set the query string
        if(isset($_SERVER['QUERY_STRING']))
            $this->query_string = $_SERVER['QUERY_STRING'];
        else
            $this->query_string = NULL;


        //  Setting this class and function as the error_handler, the & is important
        set_error_handler(array(&$this, 'log_error'));
    }

    public function log_error($errno, $errstr, $errfile, $errline)
    {
        echo 'am i working?';
    }
}
4

0 回答 0