From e2333b97db2b29fb6876f7cb8e0d63a00e49684a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 14 Mar 2016 22:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E9=83=A8=E7=BD=B2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E5=BC=82=E5=B8=B8=E6=97=A5=E5=BF=97=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E8=AF=A6=E7=BB=86=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Error.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/library/think/Error.php b/library/think/Error.php index ef5cf660..854aadab 100644 --- a/library/think/Error.php +++ b/library/think/Error.php @@ -70,7 +70,7 @@ class Error // 部署模式仅显示 Code 和 Message $data = [ 'code' => $exception->getCode(), - 'message' => Config::get('show_error_msg') ? $exception->getMessage() : Config::get('error_message'), + 'message' => $exception->getMessage(), ]; $log = "[{$data['code']}]{$data['message']}"; } @@ -136,15 +136,18 @@ class Error /** * 输出异常信息 * @param \Exception $exception - * @param Array $vars 异常信息 + * @param array $data 异常信息 * @return void */ - public static function output($exception, array $vars) + public static function output($exception, array $data) { http_response_code($exception instanceof Exception ? $exception->getHttpStatus() : 500); $type = Config::get('default_return_type'); - + if (!APP_DEBUG) { + // 部署模式不显示详细错误信息 + $data['message'] = Config::get('show_error_msg'); + } if (IS_API && 'html' != $type) { // 异常信息输出监听 APP_HOOK && Hook::listen('error_output', $data); @@ -152,7 +155,7 @@ class Error Response::send($data, $type, Config::get('response_return')); } else { //ob_end_clean(); - extract($vars); + extract($data); include Config::get('exception_tmpl'); } }