From 95feafe25d29216312afadd49a3bb39a13a613e2 Mon Sep 17 00:00:00 2001 From: pvfho47bq <3265166857@qq.com> Date: Thu, 9 Jan 2025 09:34:39 +0800 Subject: [PATCH] Update msg.lib.php --- core/msg.lib.php | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/core/msg.lib.php b/core/msg.lib.php index 359f963..a009ce0 100644 --- a/core/msg.lib.php +++ b/core/msg.lib.php @@ -1,28 +1,35 @@ 返回类型可能不明确,因为exit函数会导致脚本终止。 */ - public static function returnErrMsg($code, $errorMsg = null) { - // 初始化错误消息数组,包含错误码 - $returnMsg = array('error_code' => $code); - // 如果提供了自定义错误信息,则添加到错误消息数组中 - if (!empty($errorMsg)) { - $returnMsg['custom_msg'] = $errorMsg; - } - // 如果没有提供自定义错误信息,则使用默认错误信息 - // 这里可以根据错误码从错误码常量类中获取对应的错误信息 - // $returnMsg['custom_msg'] = MsgConstant::ERROR_NO_BINDING_TEXT; - $returnMsg['custom_msg'] = '出错啦!'.$returnMsg['custom_msg'];// 添加默认错误前缀信息 - exit($returnMsg['custom_msg']);// 退出程序并输出错误信息 - } -} -?> + public static function returnErrMsg($code, $errorMsg = null) { + // 初始化错误消息数组,包含错误码 + $returnMsg = array('error_code' => $code); + // 如果提供了自定义错误信息,则添加到错误消息数组中 + if (!empty($errorMsg)) { + $returnMsg['custom_msg'] = $errorMsg; + } + // 如果没有提供自定义错误信息,则使用默认错误信息 + // 这里可以根据错误码从错误码常量类中获取对应的错误信息 + // $returnMsg['custom_msg'] = MsgConstant::ERROR_NO_BINDING_TEXT; + // 添加默认错误前缀信息 + $returnMsg['custom_msg'] = '出错啦!' . $returnMsg['custom_msg']; + // 退出程序并输出错误信息 + exit($returnMsg['custom_msg']); + } +} \ No newline at end of file