改进Db类的强制重连

This commit is contained in:
thinkphp
2017-07-12 10:27:48 +08:00
parent 8e61503111
commit 8d731b2f4c

View File

@@ -82,10 +82,9 @@ class Db
Log::record('[ DB ] INIT ' . $options['type'], 'info'); Log::record('[ DB ] INIT ' . $options['type'], 'info');
} }
if (true === $name) { if (true === $name) {
return new $class($options); $name = md5(serialize($config));
} else {
self::$instance[$name] = new $class($options);
} }
self::$instance[$name] = new $class($options);
} }
return self::$instance[$name]; return self::$instance[$name];
} }