weapp/authorizations 报 class serializer 不存在
前言:
- 直接下载的larabbs,切换到了38的运行环境,也在出现问题后,切到weapp对比过代码(同一页面)
- 最新的homestead
- Homestead v9.0.0 released
- Settler v8.0.0 released
- 数据库也通过 homestead 建好,并且运行过db:seed ,或者说php artisan migrate --seed
问题
- 测试wechat登录接口,即:调用code时,输出用户信息
- tinker 接口已跑没 问题
- paw (没用postman) 跑下来报:POST请求,只有code字段,username/password均为空
"message":"Class serializer does not exist","code":-1,"status_code":500
- router/api.php
$api = app('Dingo\Api\Routing\Router'); $api->version('v1', [ 'namespace' => 'App\Http\Controllers\Api', 'middleware' => ['serializer:array', 'bindings', 'change-locale'] ], function($api) {
- env
API_STANDARDS_TREE=vnd API_SUBTYPE= API_STRICT=false #API_DOMAIN= API_PREFIX=api API_VERSION=v1 API_DEBUG=true
尝试
- 搜索serializer 发现仅在 router/api.php中出现过一次
- 将serializer:array 去除 ,则不报该错,而是报 This action is unauthorized. (middleware中有:bindings,理论上不应该会出现this action is unauthoried)
- 将serializer:array 将接口移到下面的游客可访问APIgroup中,一样报this action is unauthoried,访问其他接口没问题,比如api/categories就正常
- 将serializer:array 恢复,访问api/categories,继续 报:Class serializer does not exist
推荐文章: