最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Yii框架如何输出sql语句调试?
时间:2014-12-27 编辑:简简单单 来源:一聚教程网
我们使用: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.完成
如:
-
上一个: php去除字符串中的HTML标签方法总结
-
下一个: 图解PHP文件下载原理实例
相关文章
- Yii调试查看执行SQL语句的方法 02-23
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24