Yii debug 工具 dump panel 使用

1. 设置 yii debug

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        // uncomment the following to add your IP if you are not connecting from localhost.
        'allowedIPs' => ['127.0.0.1'],
        'panels' => [
            //设置dump,默认的dump只接受 application 分类,vendor/yiisoft/yii2-debug/src/panels/DumpPanel.php
            'dump' => [
                'class' => 'yii\debug\panels\DumpPanel',
                'categories' => ['response'],
            ]
        ]
    ];
}

2. 使用

//yii debug dump 默认只收集debug级别的日志
\Yii::debug("hi", "response");//response 是在配置时使用的日志分类
此条目发表在php, yii2分类目录。将固定链接加入收藏夹。