本文实例讲述了Yii框架学习笔记之应用组件操作。分享给大家供大家参考,具体如下:
所有的组件都应声明在config/web.php
//组件声明在该数组下
'components'=>array(
//自定义组件1 - 函数形式
'customComponent1' => function(){
$custom = new app\components\CustomComponent\realization\CustomComponent1();
$custom->setName('谭勇');
$custom->setAge(22);
return $