YII 1 开启调试模式以及导入第三方调试插件yii-debug-toolbar

一、开启yii 1 自带的调试模式

main.php

1.开启调试模式:

    define('YII_DEBUG', true); //是否调试BUG,本地测试请打开
    defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);

2.增加日志配置:

    'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute',
                    'levels' => 'error, warning',
                ),
                array(
                    'class'=>'CWebLogRoute',
                    'levels'=>'trace',//提示的级别
                    'categories'=>'system.db.*',
                ),

            ),
        ),

 

二、增加yii 第三方调试工具yii-debug-toolbar

    1. main.php

        1).开启调试模式:

            define('YII_DEBUG', true); //是否调试BUG,本地测试请打开


            defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);

        2)增加log配置文件

            'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                
                array(
                'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
                // Access is restricted by default to the localhost
                //'ipFilters'=>array('127.0.0.1','192.168.1.*', 88.23.23.0/24),
                ),

            ),
        ),

        3) 修改数据库配置

            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
            // uncomment the following lines to use a MySQL database
    
            'connectionString' => 'mysql:host=localhost;dbname=testdrive',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'enableProfiling'=>true,
            'enableParamLogging'=>true,

    2. 下载yii-debug-toolbar 压缩包,解压放入到项目的扩展目录,比          如 D:\wamp\www\yii117test\demo\protected\extensions 下。刷新页面如下:

 

亲测

转载于:https://my.oschina.net/youcaihua/blog/692490

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值