*/ class Error { /** * 错误码 * @var [type] */ public static $errCodes = [ 0 => "成功", 200 =>'请求成功', 1001 => '未分配销售', 2000 =>'请求参数不合法', 2001 =>'未查询到有效数据', 2002 =>'密码错误', 2003 =>'充值卡余额不足', 2014 =>'该用户还不是会员', 2015 =>'不能领取当月礼包', ]; /** * 返回错误码 * @var string */ public static function getError($code = "400", $_ = false) { if (! isset(self::$errCodes[$code])) { $code = "400"; } return ($_ ? "[{$code}]" : "") . self::$errCodes[$code]; } }