运行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中查找,找到后创建,并且初始化

相关文章:

  • 2022-12-23
  • 2021-11-07
  • 2021-03-31
  • 2021-12-28
  • 2022-12-23
  • 2021-09-15
  • 2022-02-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-08-29
相关资源
相似解决方案