Yii查看调试信息里的SQL语句
Yii的参数配置里面可以设置调试信息(不仅包括SQL语句),在/yiiroot/protected/config/main.php中配置:
1 'log'=>array(
2 'class'=>'CLogRouter',
3 'routes'=>array(
4 array(
5 'class'=>'CFileLogRoute',
6 'levels'=>'error, warning',
7 ),
8 // uncomment the following to show log messages on web pages
9 ///*
10 array(
11 'class' => 'CWebLogRoute',
12 'levels' => 'profile,trace',
13 ),
14 array(
15 'class' => 'CProfileLogRoute',
16 'levels' => 'profile',
17 ),
18 //*/
19 ),
20 ),
2 'class'=>'CLogRouter',
3 'routes'=>array(
4 array(
5 'class'=>'CFileLogRoute',
6 'levels'=>'error, warning',
7 ),
8 // uncomment the following to show log messages on web pages
9 ///*
10 array(
11 'class' => 'CWebLogRoute',
12 'levels' => 'profile,trace',
13 ),
14 array(
15 'class' => 'CProfileLogRoute',
16 'levels' => 'profile',
17 ),
18 //*/
19 ),
20 ),
页面打印的调试信息里面, "Querying SQL..."部分就是实现的SQL语句.
-------------我的签名档---------------------
年轻人,还需要多努力!
--------------------------------------------