Home >Backend Development >PHP Tutorial >Yii framework debugging experience--output and execute sql statements on the page, yiisql_PHP tutorial

Yii framework debugging experience--output and execute sql statements on the page, yiisql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:10:531103browse

Yii framework debugging experience--output and execute sql statements on the page, yiisql

We use: yiidebugtb for debugging (because the interface is more beautiful and does not affect other elements of the interface).

1. Download yiidebugtb and put it into the application.extensions.yiidebugtb directory

2. Modify main.php and add the following code:

Copy code The code is as follows:

        'log'=>array(
             'class'=>'CLogRouter',
            'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning,trace',
),

// The following is the new
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}','If the program needs to fill in your Public network ip'),
),
                                                                        ),
)

Make the following changes in the configuration of 3.db link:

Copy code The code is as follows:
         'db'=>array(
             'connectionString'=>'mysql:host=*.*.*.*;dbname=test',
'Emulateprepare' = & gt; true, // Add
              'enableParamLogging' => true, // Add
              'username'=>'-----',
              'password'=>'---',
             'charset'=>'utf8',
             'schemaCachingDuration'=>'0',
             'autoConnect'=>false,
),

4. Complete

For example:


http://www.bkjia.com/PHPjc/932470.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/932470.htmlTechArticleYii framework debugging experience--output and execute sql statements on the page, yiisql We use: yiidebugtb to debug (because he uses The interface is more beautiful and does not affect other elements of the interface). 1. Download yiide...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn