本文整理汇总了PHP中CI_Config::load方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Config::load方法的具体用法?PHP CI_Config::load怎么用?PHP CI_Config::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Config
的用法示例。
在下文中一共展示了CI_Config::load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
// first we need to check if this is called before CI_controller
// if yes, well just use default
if (!class_exists('CI_controller')) {
return parent::load($file, $use_sections, $fail_gracefully);
}
if (in_array($file, $this->is_loaded, TRUE)) {
return $this->item($file);
}
$_module = Modules::$current;
if ($path = modules::find($file, $_module, 'config')) {
// this file expected contain $config var
include $path;
if (!isset($config) or !is_array($config)) {
show_error("{$path} does not contain a valid config array");
}
log_message('debug', "File loaded: {$path}");
$current_config =& $this->config;
if ($use_sections === TRUE) {
if (isset($current_config[$file])) {
$current_config[$file] = array_merge($current_config[$file], $config);
} else {
$current_config[$file] = $config;
}
} else {
$current_config = array_merge($current_config, $config);
}
$this->is_loaded[] = $file;
unset($config);
return $this->item($file);
}
return parent::load($file, $use_sections, $fail_gracefully);
}
示例2: load
public function load($file = 'config', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = '')
{
if (in_array($file, $this->is_loaded, TRUE)) {
return $this->item($file);
}
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $file) = Modules::find($file, $_module, 'config/');
if ($path === FALSE) {
parent::load($file, $use_sections, $fail_gracefully);
return $this->item($file);
}
if ($config = Modules::load_file($file, $path, 'config')) {
/* reference to the config array */
$current_config =& $this->config;
if ($use_sections === TRUE) {
if (isset($current_config[$file])) {
$current_config[$file] = array_merge($current_config[$file], $config);
} else {
$current_config[$file] = $config;
}
} else {
$current_config = array_merge($current_config, $config);
}
$this->is_loaded[] = $file;
unset($config);
return $this->item($file);
}
}
示例3: load
/**
* Load a config file - Overrides built-in CodeIgniter config file loader
*
* @param string $file
* @param boolean $use_sections
* @param boolean $fail_gracefully
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
parent::load($file, $use_sections, $fail_gracefully);
//Local settings override permanent settings always.
if (is_readable(FCPATH . 'config.local.php')) {
parent::load('config.local.php', $use_sections, $fail_gracefully);
}
}
示例4: getConfigArray
/**
* Returns configuration array for given config file.
*
* @param string $config name of config file without extension.
* @return array<mixed> values of config file.
*/
public function getConfigArray($config)
{
if (file_exists(APPPATH . 'config/' . $config . '.php')) {
$configObject = new CI_Config();
$configObject->load($config, TRUE);
return $configObject->config[$config];
}
return NULL;
}
示例5: load
public function load($file = 'config', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = '')
{
//if (in_array($file, $this->is_loaded, TRUE)) return $this->item($file);
//echo "Модуль до определения = $_module<br>";
if ($_module === false) {
$_module = '';
} else {
$_module or $_module = CI::$APP->router->fetch_module();
}
//echo "Модуль после определения = $_module<br>";
list($path, $file) = Modules::find($file, $_module, 'config/');
if ($path === FALSE) {
parent::load($file, $use_sections, $fail_gracefully);
return $this->item($file);
}
//echo "Путь - $path, файл-$file<br>";
// добавлено для корректной работы уже загруженных файлов модулей
$file_path = $path . $file . EXT;
//echo "Данные $file_path:<br>";
//print_r($this->item($file_path));
//if (in_array($file_path, $this->is_loaded, TRUE)) return $this->item($file);
// конец добавления
if ($config = Modules::load_file($file, $path, 'config')) {
/* reference to the config array */
$current_config =& $this->config;
if ($use_sections === TRUE) {
if (isset($current_config[$file])) {
//$current_config[$file] = array_merge($current_config[$file], $config);
$current_config[$file] = $this->array_merge_recursive_distinct($current_config[$file], $config);
} else {
$current_config[$file] = $config;
}
} else {
$current_config = array_merge($current_config, $config);
}
//$this->is_loaded[] = $file;
// исправлено на:
$this->is_loaded[] = $file_path;
unset($config);
return $this->item($file);
}
}
示例6: load
/**
* Load Config File
*
* @access public
* @param string the config file name
* @param boolean if configuration values should be loaded into their own section
* @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was loaded correctly
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
// Call default config loader
$load = parent::load($file, $use_sections, true);
// Now check for any custom configs
$file = empty($file) ? 'config' : $file;
$ext = pathinfo($file, PATHINFO_EXTENSION);
$ext = empty($ext) ? '.php' : '';
$file = $file . $ext;
// Set the custom locations
$locations = array();
if (defined('ENVIRONMENT')) {
array_push($locations, CUSTOMPATH . 'config/' . ENVIRONMENT . '/' . $file);
}
array_push($locations, CUSTOMPATH . 'config/' . $file);
// Loop thru the locations
// If found, load the file
// Loop thru configs in there
// If value is array, loop again to apply to avoid overwriting any existing configs (IE: adding a new error code)
foreach ($locations as $file) {
if (file_exists($file)) {
$load = true;
include_once $file;
if (isset($config) && is_array($config)) {
foreach ($config as $k => $v) {
if (is_array($v)) {
foreach ($v as $kk => $vv) {
$this->config[$k][$kk] = $vv;
}
} else {
$this->config[$k] = $v;
}
}
unset($config);
}
break;
}
}
// Return load
return $load;
}
示例7: load
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
if ($app_path = WPCI::active_app_path(FALSE)) {
$file_path = $app_path . '/config/' . $file . EXT;
if (file_exists($file_path)) {
if (in_array($file_path, $this->is_loaded, TRUE)) {
return TRUE;
}
@(include $file_path);
if ($use_sections === TRUE) {
if (isset($this->config[$file])) {
$this->config[$file] = array_merge($this->config[$file], $config);
} else {
$this->config[$file] = $config;
}
} else {
$this->config = array_merge($this->config, $config);
}
return TRUE;
}
}
parent::load($file, $use_sections, $fail_gracefully);
}