改进Error类

This commit is contained in:
thinkphp
2016-03-01 22:41:56 +08:00
parent 28a627acac
commit f9c6ecafdb
2 changed files with 9 additions and 9 deletions

View File

@@ -141,13 +141,10 @@ class Error
*/
public static function output($exception, array $vars)
{
if ($exception instanceof Exception) {
http_response_code($exception->getHttpStatus());
} else {
http_response_code(500);
}
http_response_code($exception instanceof \Exception ? $exception->getHttpStatus() : 500);
$type = Config::get('default_return_type');
if (IS_API && 'html' != $type) {
// 异常信息输出监听
APP_HOOK && Hook::listen('error_output', $data);

View File

@@ -54,9 +54,12 @@ class Trace
'查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ',
'缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes',
'配置加载' => count(Config::get()),
'会话信息' => 'SESSION_ID=' . session_id(),
];
if (session_id()) {
$base['会话信息'] = 'SESSION_ID=' . session_id();
}
$info = Debug::getFile(true);
// 获取调试日志
@@ -70,13 +73,13 @@ class Trace
foreach ($this->tabs as $name => $title) {
$name = strtolower($name);
switch ($name) {
case 'base': // 基本信息
case 'base': // 基本信息
$trace[$title] = $base;
break;
case 'file': // 文件信息
case 'file': // 文件信息
$trace[$title] = $info;
break;
default: // 调试信息
default: // 调试信息
if (strpos($name, '|')) {
// 多组信息
$names = explode('|', $name);