您的位置:首页 > 其它

这种方式加载配置文件是一种好的方式

2017-07-10 16:27 309 查看
<!-- One situation where returning a value from a script and using it could be considered a good use is config(配置) files. Zend Framework 2 promotes(促进) this structure(结构) for this purpose, and it works pretty well.

Example config file:

这种方式加载配置文件是一种好的方式,并能把配置文件加入环境 $GLOBALS['config']数组中在全局调用的时候是非常方便的 -->

<?php
return [
'site' => 123,
'settings' => 'asd'
];

$GLOBALS['variable'] = something;

<?php
$config = (require 'config.php');
// Or
$config = array_merge(require 'config/local.php', require 'config/application.php');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: