如果你的应用是一个web应用,其index.php中(new yii\web\Application($config))->run();
调用Application的构造方法,而其继承自yii\base\Application
构造方法为
1 public function __construct($config = []) 2 { 3 Yii::$app = $this; 4 $this->setInstance($this); 5 $this->state = self::STATE_BEGIN; 6 $this->preInit($config); 7 $this->registerErrorHandler($config); 8 Component::__construct($config); 9 }