Yii Framework outputs and executes SQL statements on the page to facilitate the implementation of debugging, yiisql. Yii Framework outputs and executes SQL statements on the page to facilitate debugging. yiisql this article describes how Yii Framework outputs and executes SQL statements on the page to facilitate debugging. To facilitate the implementation of debugging, yiisql
This example describes how to execute SQL statements on the Yii Framework page to facilitate debugging. Share it with you for your reference. The specific analysis is as follows:
We use: yiidebugtb for debugging (because its interface is more beautiful and does not affect other elements on the interface ).
1. download yiidebugtb and put it in the application. extensions. yiidebugtb directory.
2. modify main. php and add the following code:
The code is as follows:
'Log' => array (
'Class' => 'clogrouter ',
'Routes '=> array (
Array (
'Class' => 'cfilelogroute ',
'Levels' => 'Error, warning, Track ',
),
// The following is the new addition
Array (// configuration for the toolbar
'Class' => 'xwebdebugrouter ',
'Config' => 'alignleft, opaque, runInDebug, fixedPos, collapsed, yamlstyle ',
'Levels' => 'Error, warning, trace, profile, info ',
// 'Category' => 'system. db .*',
'Allowedips' => array ('2017. 0.0.1 ',': 1', '192 \. 168 \. 1 [0-5] \. [0-9] {3} ', 'fill in your public ip address if the program is on the extranet '),
),
),
)
3. modify the configuration of the db link:
The code is as follows:
'DB' => array (
'Connectionstring' => 'MySQL: host = *. *; dbname = test ',
'Default' => true, // add
'Enablesparamlogging' => true, // add
'Username' => '-----',
'Password' => '---',
'Charset' => 'utf8 ',
'Schemacachingduration' => '0 ',
'Autoconnect '=> false,
),
4. shows the running effect:
I hope this article will help you design php programs based on the Yii Framework.
The Yii Framework outputs SQL statements on the page to facilitate debugging. Share with me...