猎户素材采集系统

Error.php 486B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App;
  3. class Error
  4. {
  5. public static $errCodes = [
  6. 0 => '成功',
  7. 1001 => 'URL非法',
  8. 1102 => '参数错误, 请确认无误后重试',
  9. ];
  10. /**
  11. * 返回错误码
  12. * @var string
  13. */
  14. public static function getError($code = "400", $_ = false)
  15. {
  16. if (! isset(self::$errCodes[$code])) {
  17. $code = "400";
  18. }
  19. return ($_ ? "[{$code}]" : "")
  20. . self::$errCodes[$code];
  21. }
  22. }