1、在浏览器中打开:http://frontend.cmcp-api.localhost/ ,页面的底部出现一个调试器工具栏,可以点击展开,如图1

图1

2、在 Postman 中,GET http://www.cmcp-api.localhost/v1/pages ,200响应,但是未出现一个调试器工具栏,如图2

图2

3、延续第1步,点击调试器工具栏上的 Yii Logo,可以打开可用的调试数据,如图3

图3

4、前端应用的调试器的网址:http://frontend.cmcp-api.localhost/debug/default/index ,如图4

图4

5、分析得出前端应用的调试器的网址,只需要将 frontend 替换为 www,便是接口应用的调试器的网址,打开:http://www.cmcp-api.localhost/debug/default/index ,如图5

图5

6、要查看在 Postman 中,GET http://www.cmcp-api.localhost/v1/pages 的调试数据,点击对应的URL所对应的 Tag 链接,如图6

图6

7、Log Messages 页面,便是 在 Postman 中,GET http://www.cmcp-api.localhost/v1/pages 的调试数据,如图7

图7

8、在 Log 中存在一个错误,点击进入,如图8

图8

9、参考网址:http://www.shuijingwanwq.com/2018/01/10/2206/ ,第65步,需要调整,缺少了 ‘model/*’ ,如图9

        'i18n' => [
            'translations' => [
                'model/*'=> [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'forceTranslation' => true,
                    'basePath'=>'@common/messages',
                    'fileMap'=>[
                    ],
                ],
                'app'=> [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'forceTranslation' => true,
                    'basePath'=>'@api/messages',
                    'fileMap'=>[
                    ],
                ],
                '*'=> [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'forceTranslation' => true,
                    'basePath'=>'@api/messages',
                    'fileMap'=>[
                    ],
                ],
            ],
        ],

图9

10、在 Postman 中再次请求,再次打开:http://www.cmcp-api.localhost/debug/default/index ,选择最后一条记录,点击进入,发现 Log 中的错误已经被修复,如图10

图10

 

 

永夜