yii框架学习笔记三
运行config的时候,如果cwebapplication定义有public的属性,比如basePath,则不用调用魔术函数__set
application=》run
processrequest
||
runController
|| || ||
createController $controller->init(); $controller->run($actionID);
||
framework/web/CController的run =》runActionWithFilters
组件是先注册,待需要用到时候在新建,初始化;比如loginForm.php中的login()
Yii::app()->user会调用cwebapplication的getUser,返回组件return $this->getComponent('user');
如果$this->_components已经存在'user',直接返回,否则在注册的_componentConfig中查找,找到后创建,并且初始化