选择语言 :

 Core_Config::get

获取制定key的配置

fixed Core_Config::get( string $key [, string $type = empty , boolean $no_cache = bool false ] )

参数列表

参数 类型 描述 默认值
$key string KEY
$type string 类型 empty
$no_cache boolean 是否允许使用缓存 设置true将直接从数据库中查询 bool false
返回值
  • fixed
File: ./core/classes/config.class.php
public function get($key, $type='', $no_cache = false)
{
    $type = (string)$type;

    if ($no_cache)
    {
        # 没有缓存数据,则直接在数据库里获取
        $db = new Database($this->database);
        $config = $db->from($this->tablename)->select('value')->where('type', $type)->where('key_md5', md5($key))->limit(1)->get(false, true)->get('value');

        if ($config)
        {
            return $this->data_unformat($config);
        }
    }

    if (!isset($this->config[$type]))$this->reload(false, $type);

    if (isset($this->config[$type][$key]))return $this->config[$type][$key];

    return null;
}