Yii Framework outputs and executes SQL statements on the page to facilitate debugging implementation. yiisql_PHP tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.