Yii-如何调用extension扩展
Components的方法引入以及定义:
在config.php文件里面
'components'=>array(
'helloword'=>array(
'class'=>'ext.helloword.HellowordClass',
'property1′=>'value1',
'property2′=>'value2',
),
// other component configurations
),
使用方法:
在任何地方,使用Yii::app()->helloword,就可以直接使用helloword这个component了。
component的加载方式是 lazilycreated的,只要我们不是在preload=array()里面定义,当第一次使用的时候,才会实例化的,所以不用担心说把它放在config.php里面会影响性能。
查看完整版本: Yii-如何调用extension扩展
Tags: