Think/Db.php
public static function getInstance(array $config = [])
    {
        !$config && $config = static::getConfig();
        $md5 = to_guid_string($config);
        if (!isset(static::$instance[$md5])) {
            // 兼容mysqli
            if ('mysqli' == $config['type']) {
                $config['type'] = 'mysql';
            }
            $class = __NAMESPACE__.'\\Db\\Driver\\'.ucwords(strtolower($config['type']));
            try {
                if (!class_exists($class)) {
                    throw new DbDriverNotFoundException();
                }
                static::$instance[$md5] = new $class($config);
            } catch (DbDriverNotFoundException $e) {
                throw new BaseException($e->getMessage().'类名:'.$class);
            }
        }
        static::$_instance = static::$instance[$md5];

        return static::$_instance;
    }
public static function getInstance(array $config = [])
    {
        !$config && $config = static::getConfig();
        $md5 = to_guid_string($config);
        if (!isset(static::$instance[$md5])) {
            // 兼容mysqli
            if ('mysqli' == $config['type']) {
                $config['type'] = 'mysql';
            }
            $class = __NAMESPACE__.'\\Db\\Driver\\'.ucwords(strtolower($config['type']));
            try {
                if (!class_exists($class)) {
                    throw new DbDriverNotFoundException();
                }
                static::$instance[$md5] = new $class($config);
            } catch (DbDriverNotFoundException $e) {
                throw new BaseException($e->getMessage().'类名:'.$class);
            }
        }
        static::$_instance = static::$instance[$md5];

        return static::$_instance;
    }
取得数据库类实例

@param mixed $config 连接配置
@return $this
@throws BaseException