开发者

In CodeIgniter, where should I declare my global variables?

开发者 https://www.devze.com 2022-12-10 16:12 出处:网络
I want to declare some global variables and global constants.Normally, I would put them in the includes/global.php of my own custom framework.

I want to declare some global variables and global constants. Normally, I would put them in the includes/global.php of my own custom framework.

Where should I define globals in CodeIgniter? Here's an example of the globals I want to declare:

define('USER开发者_StackOverflow社区STAT_OFFLINE', 0);
define('USERSTAT_ONLINE', 1);
define('USERSTAT_AWAY', 2);
define('USERSTAT_BUSY', 3);

$PAYMENT_PLANS = array();
$PAYMENT_PLANS[] = array('id'=>1, 'name'=>'Trial');
$PAYMENT_PLANS[] = array('id'=>2, 'name'=>'Premium Plan');


You may utilise config file (system/application/config/config.php) to set configuration related variables.

Or use constant file (system/application/config/constants.php) to store site preference constants.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号