這裏採用的是yii2的advanced的版本。配置接口訪問的debug模式。
配置文件目錄: frontend/config/main-local.php
配置內容:
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug']['class'] = 'yii\debug\Module';
$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佔有率,執行時間等。