mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-04 15:24:07 +01:00
37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
Entry Script
|
|
============
|
|
|
|
Entry script is the bootstrap PHP script that handles user requests
|
|
initially. It is the only PHP script that end users can directly request to
|
|
execute.
|
|
|
|
In most cases, entry script of a Yii application contains the code that
|
|
is as simple as follows,
|
|
|
|
~~~
|
|
[php]
|
|
// remove the following line when in production mode
|
|
defined('YII_DEBUG') or define('YII_DEBUG',true);
|
|
// include Yii bootstrap file
|
|
require_once('path/to/yii/framework/yii.php');
|
|
// create application instance and run
|
|
$configFile='path/to/config/file.php';
|
|
Yii::createWebApplication($configFile)->run();
|
|
~~~
|
|
|
|
The script first includes the Yii framework bootstrap file `yii.php`. It
|
|
then creates a Web application instance with the specified configuration
|
|
and runs it.
|
|
|
|
Debug Mode
|
|
----------
|
|
|
|
A Yii application can run in either debug or production mode according to
|
|
the constant value `YII_DEBUG`. By default, this constant value is defined
|
|
as `false`, meaning production mode. To run in debug mode, define this
|
|
constant as `true` before including the `yii.php` file. Running application
|
|
in debug mode is less efficient because it keeps many internal logs. On the
|
|
other hand, debug mode is also more helpful during development stage
|
|
because it provides richer debugging information when error occurs.
|
|
|
|
<div class="revision">$Id$</div> |