模块

Config_File

File-based configuration reader. Multiple configuration directories can be used by attaching multiple instances of this class to BootPHP_Config.

package
BootPHP
category
配置
author
Tinsh
copyright
© 2005-2016 Kilofox Studio

该类在 SYSPATH/classes/config/file.php 第 13 行声明。

常量

属性

属性

protected string $_directory

The directory where config files are located

方法

public __construct( [ string $directory = string(6) "config" ] ) (在 Config_File 中定义)

Creates a new file reader using the given directory as a config source

参数

  • string $directory = string(6) "config" - Configuration directory to search

源代码

public function __construct($directory = 'config')
{
	// Set the configuration directory name
	$this->_directory = trim($directory, '/');
}

public load( string $group ) (在 Config_File 中定义)

Load and merge all of the configuration files in this group.

$config->load($name);

参数

  • string $group required - Configuration group name

Tags

返回值

  • $this - Current object

源代码

public function load($group)
{
	$config = array();
	if ($files = BootPHP::find_file($this->_directory, $group, NULL, true))
	{
		foreach ($files as $file)
		{
			// Merge each file to the configuration array
			$config = Arr::merge($config, BootPHP::load($file));
		}
	}
	return $config;
}