Beispiel #1
0
     * 致命错误捕获
     */
    public static function fatalError()
    {
        if ($e = error_get_last()) {
            switch ($e['type']) {
                case E_ERROR:
                case E_PARSE:
                case E_CORE_ERROR:
                case E_COMPILE_ERROR:
                case E_USER_ERROR:
                    if (PHP_SAPI != 'cli') {
                        ob_end_clean();
                        if (SsdPHP::isDebug()) {
                            echo "\n\t\t\t\t\t\t<table border='1' cellpadding='3' style='font-size: 75%;border: 1px solid #000000;border-collapse: collapse;'><tr bgcolor='red'><td colspan='4' style='color: white'>fatalError!</td></tr><tr style='background-color: #ccccff; font-weight: bold; color: #000000;'> <th >type</th><th >File</th><th >Line</th><th >Message</th></tr><tr style='background-color: #cccccc; color: #000000;'><td>{$e['type']}</td><td>{$e['file']}</td><td>{$e['line']}</td><td>{$e['message']}</td></tr></table><hr style='background-color: #cccccc; border: 0px; height: 1px;' />";
                        }
                    }
                    break;
            }
        }
    }
}
if (SsdPHP::isDebug()) {
    RegShutdownEvent::add('SsdPHP\\Core\\Error::fatalError');
    set_error_handler('SsdPHP\\Core\\Error::error_handler', E_ALL);
    set_exception_handler('SsdPHP\\Core\\Error::exception_handler');
    //系统自定义日志
    if (class_exists('\\App\\Task\\controller\\systemLog')) {
        RegShutdownEvent::add('\\App\\Task\\controller\\systemLog::writeLog');
    }
}