This article mainly introduces the Yii Framework debugging experience-execute SQL statements on the page output. For more information, see yiidebugtb, 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. Complete
For example: