From 8b5f90bd00123b608766d879276f1b53390ba07e Mon Sep 17 00:00:00 2001 From: lslcoded <1058844079@qq.com> Date: Sat, 30 Jun 2018 16:25:19 +0800 Subject: [PATCH] Update Connection.php --- src/Connection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index f48921f..40d1c26 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -616,7 +616,7 @@ public function replicaSetConnect() if ($this->config['debug']) { $startTime = microtime(true); } - $this->config['params']['replicaSet'] = $this->config['database']; + // $this->config['params']['replicaSet'] = $this->config['database']; $manager = new Manager($this->buildUrl(), $this->config['params']); if ($this->config['debug']) { // 记录数据库连接信息 @@ -637,7 +637,7 @@ private function buildUrl() for ($i = 0; $i < count($hostList); $i++) { $url = $url . $hostList[$i] . ':' . $portList[0] . ','; } - return rtrim($url, ",") . '/'; + return rtrim($url, ",") . ($this->config['database'] ? "/{$this->config['database']}" : ''); } /**