1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App;
- class Error
- {
- public static $errCodes = [
- 0 => '成功',
- 1001 => 'URL非法',
- 1102 => '参数错误, 请确认无误后重试',
- ];
- /**
- * 返回错误码
- * @var string
- */
- public static function getError($code = "400", $_ = false)
- {
- if (! isset(self::$errCodes[$code])) {
- $code = "400";
- }
- return ($_ ? "[{$code}]" : "")
- . self::$errCodes[$code];
- }
- }
|