yii1.0怎么設(shè)置常量

YII1.0設(shè)置常量的方法:首先新建“constants.php”;然后通過方法“define(‘CL’, ‘https://www.baidu.com/’);”定義常量;接著把常量引入系統(tǒng);最后在系統(tǒng)的任意位置調(diào)用系統(tǒng)常量即可。

yii1.0怎么設(shè)置常量

yii 設(shè)置系統(tǒng)常量

推薦:《yii教程

1,在protectded/config/下新建constants.php

2,在constants.php里面定義常量 define(‘CL’, ‘https://www.baidu.com/’);//常量名,常量內(nèi)容

3,把常量引入系統(tǒng):在入口index.php文件里引入系統(tǒng),require_once(dirname(__FILE__).’/protected/config/constants.php’);

4,在系統(tǒng)的任意位置調(diào)用系統(tǒng)常量:

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點贊7 分享