返回数据库实例化对象
Database Module_Storage::instance( [ string $config_name = null ] )
参数列表
参数 类型 描述 默认值 $config_name
string
默认值为 Database::DEFAULT_CONFIG_NAME null
Database
public static function instance($config_name = null)
{
if (null===$config_name)
{
$config_name = Storage::DEFAULT_CONFIG_NAME;
}
if (is_string($config_name))
{
$i_name = $config_name;
}
else
{
$i_name = '.config_' . md5(serialize($config_name));
}
if (!isset(Storage::$instances[$i_name]))
{
Storage::$instances[$i_name] = new Storage($config_name);
}
return Storage::$instances[$i_name];
}