ErrorCode.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace WeChat\Prpcrypt;
  3. /**
  4. * 仅用作类内部使用
  5. * 不用于官方API接口的errCode码
  6. * Class ErrorCode
  7. */
  8. class ErrorCode
  9. {
  10. public static $OK = 0;
  11. public static $ParseXmlError = 40002;
  12. public static $IllegalAesKey = 40004;
  13. public static $IllegalBuffer = 40008;
  14. public static $EncryptAESError = 40006;
  15. public static $DecryptAESError = 40007;
  16. public static $EncodeBase64Error = 40009;
  17. public static $DecodeBase64Error = 40010;
  18. public static $GenReturnXmlError = 40011;
  19. public static $ValidateAppidError = 40005;
  20. public static $ComputeSignatureError = 40003;
  21. public static $ValidateSignatureError = 40001;
  22. public static $errCode = [
  23. '0' => '处理成功',
  24. '40001' => '校验签名失败',
  25. '40002' => '解析xml失败',
  26. '40003' => '计算签名失败',
  27. '40004' => '不合法的AESKey',
  28. '40005' => '校验AppID失败',
  29. '40006' => 'AES加密失败',
  30. '40007' => 'AES解密失败',
  31. '40008' => '公众平台发送的xml不合法',
  32. '40009' => 'Base64编码失败',
  33. '40010' => 'Base64解码失败',
  34. '40011' => '公众帐号生成回包xml失败',
  35. ];
  36. /**
  37. * 获取错误消息内容
  38. * @param string $code 错误代码
  39. * @return bool
  40. */
  41. public static function getErrText($code)
  42. {
  43. if (isset(self::$errCode[$code])) {
  44. return self::$errCode[$code];
  45. }
  46. return false;
  47. }
  48. }