返回类型可能不明确,因为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']);// 退出程序并输出错误信息 } } ?>