一、开启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 下。刷新页面如下:

 

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

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

相关文章:

  • 2021-04-19
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2021-07-30
  • 2021-10-08
猜你喜欢
  • 2021-05-20
  • 2022-12-23
  • 2022-01-11
  • 2021-07-21
  • 2021-08-16
  • 2021-05-23
  • 2022-01-08
相关资源
相似解决方案