Php 组件类Yii的实例化
我试图理解一系列的安装组件类。据我所知,应用程序组件类具有延迟初始化(我已经记录了Php 组件类Yii的实例化,php,yii,components,Php,Yii,Components,我试图理解一系列的安装组件类。据我所知,应用程序组件类具有延迟初始化(我已经记录了init()方法的启动调用)。让我创建一个名为document的简单测试组件: class Document extends CApplicationComponent{ private $_width='150'; public function init(){ echo "This is document component init method.";
init()
方法的启动调用)。让我创建一个名为document
的简单测试组件:
class Document extends CApplicationComponent{
private $_width='150';
public function init(){
echo "This is document component init method.";
}
public function getWidth(){
return $this->_width;
}
}
我已将相应组件的数组添加到config.php
:
'components'=>array(
'document' => array( 'class' => 'document')
)
它是有效的,但我不明白它的意思。实际上,让我们将组件的文件从
Document.php
重命名为DDocument.php
。此重命名后引发异常为什么?我们不重命名config.php中指定的组件类名。组件数组的键意味着什么?它只是Yii::app()
对象的属性吗?它们是capapplicationcomponent
的实例吗?看,祝你好运 有谁能告诉我如何在yii Cgridview中添加自定义行吗很抱歉在这里问一下,因为我是stackoverflow的新手,当我单击“询问问题”时,它将提供帮助center@GauravParashar您必须应用站点规则,并且可以进一步询问您的问题。