这种方式加载配置文件是一种好的方式
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');
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');
相关文章推荐
- Spring加载多个配置文件的方式
- Spring中加载配置文件的方式
- spring 配置文件加载方式
- Spring中加载配置文件的方式
- spring 中加载xml配置文件的方式.
- 类路径下加载配置文件的最好方式
- 黑马程序员----加载配置文件和通过内省方式操作javabean总结
- Unity加载配置文件的两种方式
- 几种加载Spring的配置文件的方式
- spring中加载xml配置文件的方式
- Ehcache配置文件加载方式
- Spring之配置文件加载方式
- 加载spring配置文件的三种方式
- 反射的应用,读取properties配置文件中的数据(普通InputStream方式,类加载方式),再调用运行
- spring 中加载xml配置文件的方式
- 两种方式加载配置文件
- Spring中加载xml配置文件的方式
- Spring中加载XML配置文件的方式
- spring的配置文件在web.xml中加载的方式
- Spring的ApplicationContext加载多个配置文件的三种方式