qifen / webman-api-response
1.1
2022-03-03 05:26 UTC
Requires
- workerman/webman-framework: ^1.2.1
This package is auto-updated.
Last update: 2025-03-29 01:03:25 UTC
README
composer require qifen/webman-api-response
类
webman Response 接口
use Qifen\WebmanApiResponse\ApiResponse; use ApiResponse; // 如果增加其他code 可以继承 Qifen\WebmanApiResponse\Code 并修改 配置文件的类库 class CustomCode extends Code { const CODE_CUSTOM = 99; const EXTENDS_MAP = [ self::CODE_CUSTOM => '自定义消息' ]; public static function getStatusText($code, string $msg = '') { if (!empty($msg)) return $msg; $map = self::STATUS_MAP + self::EXTENDS_MAP; return isset($map[$code]) ? $map[$code] : ''; } }