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