一、入口脚本
/web/index.php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);//开启或关闭debug模式
defined('YII_ENV') or define('YII_ENV', 'dev'); //设置开发模式
require(__DIR__ . '/../vendor/autoload.php');//注册composer 自动加载器
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');//加载yii核心类文件
$config = require(__DIR__ . '/../config/web.php'); //加载应用配置文件
(new yii\web\Application($config))->run(); //实例化应用调用run方法处理请求
二、请求到响应的运行生命周期