Yii::$app

如果你的应用是一个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 }

 

posted @ 2016-03-23 09:07  WilliamShaw  阅读(620)  评论(0编辑  收藏  举报