时间:2021-07-01 10:21:17 帮助过:24人阅读
那么,大家知道Yii预定义了哪些组件吗,它们都是在哪里预定义的?
首先,在CApplication.php文件(https://github.com/yiisoft/yii/blob/1.1.16/framework/base/CApplication.php)中,预定义了如下组件:
$components=array( | |
'coreMessages'=>array( | |
'class'=>'CPhpMessageSource', | |
'language'=>'en_us', | |
'basePath'=>YII_PATH.DIRECTORY_SEPARATOR.'messages', | |
), | |
'db'=>array( | |
'class'=>'CDbConnection', | |
), | |
'messages'=>array( | |
'class'=>'CPhpMessageSource', | |
), | |
'errorHandler'=>array( | |
'class'=>'CErrorHandler', | |
), | |
'securityManager'=>array( | |
'class'=>'CSecurityManager', | |
), | |
'statePersister'=>array( | |
'class'=>'CStatePersister', | |
), | |
'urlManager'=>array( | |
'class'=>'CUrlManager', | |
), | |
'request'=>array( | |
'class'=>'CHttpRequest', | |
), | |
'format'=>array( | |
'class'=>'CFormatter', | |
), | |
); |
然后在CWebApplication.php文件(https://github.com/yiisoft/yii/blob/1.1.16/framework/web/CWebApplication.php),预定义了如下组件:
'Session'=>array( | |
'class'=>'CHttpSession', | |
), | |
'assetManager'=>array( | |
'class'=>'CAssetManager', | |
), | |
'user'=>array( | |
'class'=>'CWebUser', | |
), | |
'themeManager'=>array( | |
'class'=>'CThemeManager', | |
), | |
'authManager'=>array( | |
'class'=>'CPhpAuthManager', | |
), | |
'clientScript'=>array( | |
'class'=>'CClientScript', | |
), | |
'widgetFactory'=>array( | |
'class'=>'CWidgetFactory', | |
), |
以上就介绍了Yii框架预定义的组件有哪些?,包括了Session,Application,github方面的内容,希望对PHP教程有兴趣的朋友有所帮助。