Home >PHP Framework >YII >How to call extension class in php yii

How to call extension class in php yii

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-12-09 13:25:052835browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more