Yii Framework official tutorial 5-Basic Knowledge: Portal script

Source: Internet
Author: User
The entry script is used to process the user's initial boot PHP script. It is the only PHP script that an end user can directly request for execution. In most cases, the entry script of a Yii application contains a simple script like the following: in the production environment...



The entry script is used to process the user's initial boot PHP script. It is the only PHP script that an end user can directly request for execution.

In most cases, the entry script of a Yii application contains a simple script like the following:

// Delete the defined ('yii _ debug') or define ('yii _ debug', true) line in the production environment ); // contains the Yii boot file require_once ('path/to/yii/framework/yii. php '); // create an application instance and execute $ configFile = 'path/to/config/file. php '; Yii: createWebApplication ($ configFile)-> run ();

The script first contains the Yii Framework boot file yii. php. Then, a Web application instance is created and executed according to the specified configuration.

Debugging Mode

Yii applications can run in debugging or production mode according to the value of the constant YII_DEBUG. By default, this constant value is defined as false, meaning the production mode. To run in debug mode, you need to define this constant to true before including the yii. php file. Running an application in debug mode is less efficient because it requires a lot of internal logs. In addition, the debugging mode is very useful in the development environment because it provides a wealth of debugging information when errors are generated.

defined('YII_DEBUG') or define('YII_DEBUG',true);

It is equivalent:

if (!defined('YII_DEBUG')) {    define('YII_DEBUG', true);}

In short, it is enabled if debug mode is not enabled.

You can also define the levels of the debug callback stack:

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

The callback stack is the history of including and calling files and functions. in the framework, simple homepage loading usually contains the right action. to strictly ensure the latest and most useful information of log data, the callback stack limits the number of rows to the latest three actions. If you need more debugging information, you can change the value of YII_TRACE_LEVEL.

When checking the debugging configuration, it is recommended that the display_errors setting of PHP be enabled, otherwise the error parsing will be output to a blank screen.

The above is an additional article 5 of the Yii Framework official tutorial-Basic Knowledge: content of the portal script. For more information, see The PHP Chinese website (www.php1.cn )!

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.