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 )!