Query类增加connect方法用于切换数据库

This commit is contained in:
thinkphp
2016-06-06 18:01:55 +08:00
parent 29c8faf118
commit 3baf150ce1

View File

@@ -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