Home >PHP Framework >YII >How to set constants in yii1.0

How to set constants in yii1.0

藏色散人
藏色散人Original
2020-07-20 10:59:502700browse

Yii1.0 method of setting constants: first create a new "constants.php"; then define the constants through the method "define('CL', 'https://www.baidu.com/');"; Then introduce the constants into the system; finally, call the system constants anywhere in the system.

How to set constants in yii1.0

yii Set system constants

Recommended: "yii tutorial"

1, create a new constants.php under protected/config/

2, define constants in constants.php define('CL', 'https://www.baidu.com/');/ /Constant name, constant content

3, introduce constants into the system: introduce the system into the entry index.php file, require_once(dirname(__FILE__).'/protected/config/constants.php');

4. Call system constants anywhere in the system:

The above is the detailed content of How to set constants in yii1.0. 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