yii framework 运行流程

2014-04-10 10:27:16 0  category: PHP记事本
<?php
//Yii::createWebApplication( $config )->run(); yii extends yiibase index.php; yii.php -> yiibase.php;
// yiibase::createWebApplication; CWebApplication extends CApplication extends CModule extends CComponent
// f/web/CWebApplication.php f/base/CApplication.php f/base/CModule.php f/base/CComponent.php
//
// CApplication->_construct() ..> CWebApplication
// YiiBase::setApplication
// require p/config/main.php
// require p/config/params.php
// CApplication->setBasePath()
// CApplication->getBasePath()
// YiiBase::setPathOfAlias()
// CApplication->getBasePath()
// YiiBase::setPathOfAlias()
// CApplication->initSystemHandlers()
// CApplication->registerCoreComponents()
// CModule->configure()
// CComponent->attachBehaviors()
// CModule->preloadComponents()
// CWebApplication->init()
// CModule->init()
// CApplication->getRequest()
// CModule->getComponent()
// YiiBase::createComponent()
// CHttpRequest->init()
//
// CApplication->run()
// CComponent->hasEventHandle()
//
//
//
//
//
//
//
//
//
Yii::createWebApplication( $config )->run();

Yii yii.php ->yiibase.php

YiiBase::CWebApplication( $config )->run();
CWebApplication ..> CApplication()->run(); //index.php Yii::createWebApplication( $config )->run();
CWebApplication->processRequest()
CWebApplication->runController( $route );
CController->run()
CController->createAction()
CController->runActionWithFilers()
CFilterChain->run()
CInlineFilter->filter()
CController->filterAccessControl()
CFilter->filter()
CFilterChain-run()
CController->runAction()
CInlineAction->runWithParams()
PostController->actionIndex()
CController->render()
CController->renderPartial()
CBaseController->renderFile()
CBaseController->renderInternal()
require p/views/post/index.php // ...........>
CBaseController->widget()
CBaseListView->run()
CBaseListView->renderContent()
preg_replace_callback()
CBaseListView->renderSection()
CListView->renderltems()
CBaseController->renderFile()
CBaseController->renderInternal()
require p/views/post/_view.php // ........>
$data //... post object orm








<?php
# main
# Yii::createWebApplication( $config )
# CApplication->__construct()
# Yii::setApplication($this); // 将 CWebApplication 对像注册到 Yii::app();
# Yii::setPathOfAlias( 'application', $this->getBasePath()) // 当前应用路径
# Yii::setPathOfAlias( 'webroot', dirname($_SERVER['SCRIPT_FILENAME'])); // web根路径
# Yii::setPathOfAlias('ext',$this->getBasePath().DIRECTORY_SEPARATOR.'extensions'); ext 路径
# CModule->preinit();
# CApplication->initSystemHandlers() // 设置错误 handler
# CWebApplication->registerCoreComponents() 注册核心组件
# CApplication->registerCoreComponents() 注册核心组件
# CModule->setComPonents()
# CModule->setComponent()
# CModule->configure() Configures the module with the specified configuration.
# CComponent->_set()
# CComponent->attachBehaviors()
# CModule->preloadComponents() // config['preload'] => ['log']
# CWebApplication->init();
# CApplication->getRequest()
# CModule->getComponent('getRequest')
#
#
#
#
#
# CwebApplication->run();
# CComponent->hasEventHandler()
# php::register_shutdown_function( [$this,'end'],0,false)
# CWebApplication->processRequest() // 开始运行
# this->geturlManager()->parseurl($this->request());
# CWebApplication->runController($route)
# CWebApplication->createController()
# CController->run()
# CController->createAction()
# $this->runActionWithFilters(inlineaction,sitecontroller->filters());
# CFilterChain::create($this,$action,$filters)->run();
# CInlineFilter->filter()
# CController->filterAccessControl()
# CAccessControlFilter->setRules()
# CAccessControlFilter->filter()
# CAccessControlFilter->preFilter()
# CFilterChain->run()
# CController->runAction()
# CInlineAction->runWithParams()
# UserController->actionIndex()
#
#
#
#
#
# CComponent->hasEventHandler('onEndRequest') // 结束
# CApplication->onEndRequest()
# CComponent->raiseEvent()
# CList->getlterator()
# log
#
#
#
#Yii -> YiiBase -> createWebApplication
#CWebApplication -> CApplication -> CModule -> CComponent
#siteController -> Controller -> CController -> CBaseController -> CComponent
#LimitAppModel -> CActiveRecord -> CModel -> CComponent ->I IteratorAggregate, ArrayAccess
#
#View layouts -> main -> column -> site/index.php





9311376559308.jpg