yii2 debug 功能

這裏採用的是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佔有率,執行時間等。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章