mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
改进Error类
This commit is contained in:
@@ -141,13 +141,10 @@ class Error
|
|||||||
*/
|
*/
|
||||||
public static function output($exception, array $vars)
|
public static function output($exception, array $vars)
|
||||||
{
|
{
|
||||||
if ($exception instanceof Exception) {
|
http_response_code($exception instanceof \Exception ? $exception->getHttpStatus() : 500);
|
||||||
http_response_code($exception->getHttpStatus());
|
|
||||||
} else {
|
|
||||||
http_response_code(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = Config::get('default_return_type');
|
$type = Config::get('default_return_type');
|
||||||
|
|
||||||
if (IS_API && 'html' != $type) {
|
if (IS_API && 'html' != $type) {
|
||||||
// 异常信息输出监听
|
// 异常信息输出监听
|
||||||
APP_HOOK && Hook::listen('error_output', $data);
|
APP_HOOK && Hook::listen('error_output', $data);
|
||||||
|
|||||||
@@ -54,9 +54,12 @@ class Trace
|
|||||||
'查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ',
|
'查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ',
|
||||||
'缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes',
|
'缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes',
|
||||||
'配置加载' => count(Config::get()),
|
'配置加载' => count(Config::get()),
|
||||||
'会话信息' => 'SESSION_ID=' . session_id(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (session_id()) {
|
||||||
|
$base['会话信息'] = 'SESSION_ID=' . session_id();
|
||||||
|
}
|
||||||
|
|
||||||
$info = Debug::getFile(true);
|
$info = Debug::getFile(true);
|
||||||
|
|
||||||
// 获取调试日志
|
// 获取调试日志
|
||||||
@@ -70,13 +73,13 @@ class Trace
|
|||||||
foreach ($this->tabs as $name => $title) {
|
foreach ($this->tabs as $name => $title) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'base': // 基本信息
|
case 'base': // 基本信息
|
||||||
$trace[$title] = $base;
|
$trace[$title] = $base;
|
||||||
break;
|
break;
|
||||||
case 'file': // 文件信息
|
case 'file': // 文件信息
|
||||||
$trace[$title] = $info;
|
$trace[$title] = $info;
|
||||||
break;
|
break;
|
||||||
default: // 调试信息
|
default: // 调试信息
|
||||||
if (strpos($name, '|')) {
|
if (strpos($name, '|')) {
|
||||||
// 多组信息
|
// 多组信息
|
||||||
$names = explode('|', $name);
|
$names = explode('|', $name);
|
||||||
|
|||||||
Reference in New Issue
Block a user