Home >PHP Framework >YII >How to call extension class in php yii
Components method
Introduction and definition:
In the config.php file
’components’=>array( ’xyz’=>array( ’class’=>’ext.xyz.XyzClass’, ’property1’=>’value1’, ’property2’=>’value2’, ), // other component configurations ),
Usage method:
Anywhere, use Yii::app()->xyz, you can directly use the xyz component, and the component loading method is lazilycreated, as long as we are not defined in preload=array(), then That is, it will be instantiated when it is used for the first time, so there is no need to worry that putting it in config.php will affect performance.
PHP Chinese website has a large number of free Yii introductory tutorials, everyone is welcome to learn!
The above is the detailed content of How to call extension class in php yii. For more information, please follow other related articles on the PHP Chinese website!