这里采用的是YII2的advanced的版本。配置接口访问的debug模式。
配置文件目录: frontend/config/main-local.php (推荐学习:yii教程)
配置内容:
if (!YII_ENV_TEST) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug']['class'] = 'yiidebugModule'; $config['modules']['debug']['allowedIPs'] = ['*', '127.0.0.1', '0.0.0.0']; $config['modules']['debug']['historySize'] = 200; }
allowedIPs 字段表示允许访问的ip字段。然后historySize 表示存储的debug文件大小。
输入地址 frontend/web/index.php?r=debug 来进入debug模式。
点击tag能够进入这个请求里面,然后查看sql,cpu占有率,执行时间等。
关闭debug
在入口文件添加 defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_ENV') or define('YII_ENV', 'prod');
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END