????core_config
??????÷??
????$admin_menu = (array)AWS_APP::config()->get('admin_menu');
???????
????get???????????в??????????????????load_config
????system/core/config.php#get
function get($config_id)
{
...
if (isset($this->config[$config_id]))
{
return $this->config[$config_id];
}
else
{
return $this->load_config($config_id);
}
}
????load_config???config?????????Id??????????????????????嵽?????
????system/core/config.php#load_config
function load_config($config_id)
{
if (substr($config_id?? -10) == '.extension' OR !file_exists(AWS_PATH . 'config/' . $config_id . '.php'))
{
throw new Zend_Exception('The configuration file config/' . $config_id . '.php does not exist.');
}
include_once(AWS_PATH . 'config/' . $config_id . '.php');
if (!is_array($config))
{
throw new Zend_Exception('Your config/' . $config_id . '.php file does not appear to contain a valid configuration array.');
}
$this->config[$config_id] = (object)$config;
return $this->config[$config_id];
}
????????core_config????????????д?????????????
????system/core/config.php#set
public function set($config_id?? $data)
{
if (!$data || ! is_array($data))
{
throw new Zend_Exception('config data type error');
}
$content = "<?php ";
foreach($data as $key => $val)
{
if (is_array($val))
{
$content .= "$config['{$key}'] = " . var_export($val?? true) . ";";;
}
else if (is_bool($val))
{
$content .= "$config['{$key}'] = " . ($val ? 'true' : 'false') . ";";
}
else
{
$content .= "$config['{$key}'] = '" . addcslashes($val?? "'") . "';";
}
$content .= " ";
}
$config_path = AWS_PATH . 'config/' . $config_id . '.php';
$fp = @fopen($config_path?? "w");
@chmod($config_path?? 0777);
$fwlen = @fwrite($fp?? $content);
@fclose($fp);
return $fwlen;
}