Home  >  Article  >  Backend Development  >  Yii framework outputs and executes sql statements on the page to facilitate debugging, yiisql_PHP tutorial

Yii framework outputs and executes sql statements on the page to facilitate debugging, yiisql_PHP tutorial

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

Yii framework outputs and executes sql statements on the page to facilitate debugging, yiisql

The example in this article describes how the Yii framework outputs and executes sql statements on the page to facilitate debugging. Share it with everyone for your reference. The specific analysis is as follows:

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 newly added
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'=>true, // Add
'enableParamLogging' => true, // Add
'username'=>'-----',
'password'=>'---',
'charset'=>'utf8',
'schemaCachingDuration'=>'0',
'autoConnect'=>false,
),

4. The operation effect is shown in the figure below:

I hope this article will be helpful to everyone’s PHP programming based on the Yii framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/932497.htmlTechArticleYii framework outputs and executes sql statements on the page to facilitate debugging, yiisql This article describes the implementation method of the Yii framework on the page Output the implementation method of executing sql statements to facilitate debugging. Share with everyone...
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