Module_Storage::__construct
null Module_Storage::__construct( )
File: ./modules/storage/storage.class.php
public function __construct($config_name = null)
{
if (null===$config_name)
{
$config_name = Storage::DEFAULT_CONFIG_NAME;
}
if (is_array($config_name))
{
$this->config = $config_name;
}
else
{
$this->config = Core::config('storage.' . $config_name);
}
if (!isset($this->config['driver']))
{
$this->config['driver'] = Storage::DRIVER_FILE;
}
$driver = 'Storage_Driver_' . $this->config['driver'];
if (!class_exists($driver, true))
{
throw new Exception(__('The :type driver :driver does not exist', array(':type'=>'Storge',':driver'=>$this->config['driver'])));
}
$this->driver = new $driver($this->config['driver_config']);
# 设置前缀
if ($this->config['prefix'])
{
$this->driver->set_prefix($this->config['prefix']);
}
}