/** * @return mixed * @throws \Exception * @desc fatal error处理 */ public static function fatalHandler() { $error = \error_get_last(); if (empty($error)) { return; } if (!in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR))) { return; } $config = ZConfig::get('project'); $model = ZFormater::fatal($error); $info['data'] = null; if ($config['debug_mode']) { $info['debug'] = $model; } Log::info([\var_export($model, true)], 'fatal'); $info['msg'] = $model['message']; $info['code'] = $model['code']; Response::status('200'); if ('Php' == Request::getViewMode()) { if ($config['debug_mode']) { Request::setTplFile('public/exception.php'); } else { Request::setTplFile('public/error.php'); } } Response::display($info); }