From 5b75506aa7fcef690306558286197a2abb8d06b6 Mon Sep 17 00:00:00 2001 From: huangdijia Date: Tue, 22 Dec 2015 11:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=87=A0=E5=A4=84Notice?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/app.php | 2 +- library/think/db/driver.php | 2 +- library/think/db/driver/mongo.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/think/app.php b/library/think/app.php index 8cd37249..de6519f3 100644 --- a/library/think/app.php +++ b/library/think/app.php @@ -303,7 +303,7 @@ class App // 路由检测 if (!empty($config['url_route_on'])) { // 开启路由 则检测路由配置 - Route::register($config['route']); + Route::register(!empty($config['route'])?$config['route']:null); $result = Route::check($path_info, $depr); if (false === $result) { // 路由无效 diff --git a/library/think/db/driver.php b/library/think/db/driver.php index 1be594a9..66d71ff1 100644 --- a/library/think/db/driver.php +++ b/library/think/db/driver.php @@ -1148,7 +1148,7 @@ abstract class Driver */ protected function debug($start) { - if ($this->config['debug']) { + if (!empty($this->config['debug'])) { // 开启数据库调试模式 if ($start) { Debug::remark('queryStartTime', 'time'); diff --git a/library/think/db/driver/mongo.php b/library/think/db/driver/mongo.php index 53f83c14..78962a57 100644 --- a/library/think/db/driver/mongo.php +++ b/library/think/db/driver/mongo.php @@ -70,7 +70,7 @@ class Mongo extends Driver $host = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '') . '/' . ($config['database'] ? "{$config['database']}" : ''); try { - $this->linkID[$linkNum] = new \mongoClient($host, $this->config['params']); + $this->linkID[$linkNum] = new \mongoClient($host, !empty($this->config['params'])?$this->config['params']:array()); } catch (\MongoConnectionException $e) { throw new Exception($e->getmessage()); } @@ -105,7 +105,7 @@ class Mongo extends Driver $this->_mongo = $this->_linkID->selectDb($db); } // 当前MongoCollection对象 - if ($this->config['debug']) { + if (!empty($this->config['debug'])) { $this->queryStr = $this->_dbName . '.getCollection(' . $collection . ')'; } if ($this->_collectionName != $collection) { @@ -519,7 +519,7 @@ class Mongo extends Driver $this->model = $options['model']; $this->queryTimes++; $query = $this->parseWhere($options['where']); - if ($this->config['debug']) { + if (!empty($this->config['debug'])) { $this->queryStr = $this->_dbName . '.' . $this->_collectionName; $this->queryStr .= $query ? '.find(' . json_encode($query) . ')' : ''; $this->queryStr .= '.count()';