源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Yii框架调试心得--在页面输出执行sql语句

  • 时间:2021-11-10 00:45 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Yii框架调试心得--在页面输出执行sql语句
我们使用:yiidebugtb来调试(因为用他界面比较美观,不影响界面其他元素)。 1.下载yiidebugtb,并且放入到 application.extensions.yiidebugtb 目录 2.修改main.php,加入如下代码:
[u]复制代码[/u] 代码如下:
        '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链接的配置里面做下修改:
[u]复制代码[/u] 代码如下:
        'db'=>array(             'connectionString'=>'mysql:host=*.*.*.*;dbname=test',             'emulatePrepare'=>true,   // 加入             'enableParamLogging' => true, // 加入             'username'=>'-----',             'password'=>'---',             'charset'=>'utf8',             'schemaCachingDuration'=>'0',             'autoConnect'=>false,         ),
4.完成  如: [img]http://files.jb51.net/file_images/article/201412/2014122515240560.jpg[/img]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部