From 3baf150ce131b538a8f0c70da70d308a51bda709 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 6 Jun 2016 18:01:55 +0800 Subject: [PATCH] =?UTF-8?q?Query=E7=B1=BB=E5=A2=9E=E5=8A=A0connect?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=94=A8=E4=BA=8E=E5=88=87=E6=8D=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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