yii框架,在页面输出执行sql语句,方便调试,yiisql我们使用:yiidebugtb来调试(因为用他界面比较美观,不影响界面其他元素)。
1.下载yiidebugtb,并且放入到 application.extensions.yiidebugtb 目录
2.修改main.php,加入如下代码:
'log'=>array( 'class'=>'clogrouter', 'routes'=>array( array( 'class'=>'cfilelogroute', 'levels'=>'error, warning,trace', ),
// 以下是新加 array( // configuration for the toolbar 'class'=>'xwebdebugrouter', 'config'=>'alignleft, opaque, runindebug, fixedpos, collapsed, yamlstyle', 'levels'=>'error, warning, trace, profile, info', //'categories' => 'system.db.*', 'allowedips'=>array('127.0.0.1','::1','192\.168\.1[0-5]\.[0-9]{3}','如果程序在外网需要填入你的公网的ip'), ), ), )
3.db链接的配置里面做下修改:
'db'=>array( 'connectionstring'=>'mysql:host=*.*.*.*;dbname=test', 'emulateprepare'=>true, // 加入 'enableparamlogging' => true, // 加入 'username'=>'-----', 'password'=>'---', 'charset'=>'utf8', 'schemacachingduration'=>'0', 'autoconnect'=>false, ),
4.完成
如:
http://www.bkjia.com/phpjc/931387.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/931387.htmltecharticleyii框架,在页面输出执行sql语句,方便调试,yiisql 我们使用:yiidebugtb来调试(因为用他界面比较美观,不影响界面其他元素)。 1.下载y...