首页 > 代码库 > YII数据库操作中打印sql

YII数据库操作中打印sql

配置如下:

‘components‘ => array(  ‘db‘=>array(    ‘enableParamLogging‘ => true,  ),  ‘log‘=>array(    ‘class‘=>‘CLogRouter‘,    ‘routes‘=>array(       array(        ‘class‘=>‘CFileLogRoute‘,        ‘levels‘=>‘trace,log‘,        ‘categories‘ => ‘system.db.CDbCommand‘,        ‘logFile‘ => ‘db.log‘,      ),     ),  ),);

参考:http://stackoverflow.com/questions/10629728/yii-how-to-print-sql-used-by-findall

YII数据库操作中打印sql