diff --git a/library/think/db/Query.php b/library/think/db/Query.php index ce5267f5..fcd67bd3 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -95,6 +95,18 @@ class Query return $this->connection; } + /** + * 切换当前的数据库连接 + * @access public + * @param mixed $config + * @return $this + */ + public function connect($config) + { + $this->connection = Db::connect($config); + return $this; + } + /** * 指定默认的数据表名(不含前缀) * @access public