diff --git a/library/think/Error.php b/library/think/Error.php index d53b73f0..de0f2dec 100644 --- a/library/think/Error.php +++ b/library/think/Error.php @@ -65,18 +65,18 @@ class Error 'ThinkPHP Constants' => self::getTPConst(), ], ]; - $err_msg = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; + $log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; } else { // 部署模式仅显示 Code 和 Message $data = [ 'code' => $exception->getCode(), 'message' => Config::get('show_error_msg') ? $exception->getMessage() : Config::get('error_message'), ]; - $err_msg = "[{$data['code']}]{$data['message']}"; + $log = "[{$data['code']}]{$data['message']}"; } // 记录异常日志 - Log::record($err_msg, 'error'); + Log::record($log, 'error'); // 输出错误信息 self::output($exception, $data); // 禁止往下传播已处理过的异常 diff --git a/tpl/think_exception.tpl b/tpl/think_exception.tpl index 3309cf3d..bbcbd726 100644 --- a/tpl/think_exception.tpl +++ b/tpl/think_exception.tpl @@ -1,78 +1,4 @@ - -'.end($names).''; - } -} -if (!function_exists('parse_file')) { - function parse_file($file, $line) - { - return ''.basename($file)." line {$line}".''; - } -} -if (!function_exists('parse_args')) { - function parse_args($args) - { - $result = []; - - foreach ($args as $key => $item) { - switch (true) { - case is_object($item): - $value = sprintf('object(%s)', parse_class(get_class($item))); - break; - case is_array($item): - if(count($item) > 3){ - $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); - } else { - $value = sprintf('[%s]', parse_args($item)); - } - break; - case is_string($item): - if(strlen($item) > 20){ - $value = sprintf( - '\'%s...\'', - htmlentities($item), - htmlentities(substr($item, 0, 20)) - ); - } else { - $value = sprintf("'%s'", htmlentities($item)); - } - break; - case is_int($item): - case is_float($item): - $value = $item; - break; - case is_null($item): - $value = 'null'; - break; - case is_bool($item): - $value = '' . ($item ? 'true' : 'false') . ''; - break; - case is_resource($item): - $value = 'resource'; - break; - default: - $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); - break; - } - - $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; - } - - return implode(', ', $result); - } -} -?> +
@@ -150,7 +76,7 @@ if (!function_exists('parse_args')) { display: inline-block; min-width: 100%; box-sizing: border-box; - padding-left: px; + padding-left: px; } .exception .source-code pre li{ border-left: 1px solid #ddd; @@ -240,6 +166,7 @@ if (!function_exists('parse_args')) { +