From 8cb52f60dd97458bfbd4d2f3f32dcd19c358f2e1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Apr 2016 12:12:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84join?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helper.php | 2 +- library/think/db/Query.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helper.php b/helper.php index ef75f58e..5b4df203 100644 --- a/helper.php +++ b/helper.php @@ -341,7 +341,7 @@ function trace($log = '[think]', $level = 'log') */ function view($template = '', $vars = []) { - return View::instance(Config::get('template'))->fetch($template, $vars); + return View::instance(Config::get('template'), Config::get('view_replace_str'))->fetch($template, $vars); } /** diff --git a/library/think/db/Query.php b/library/think/db/Query.php index e1b725b5..31ae15fd 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -349,7 +349,7 @@ class Query if (count($join)) { // 有设置第二个元素则把第二元素作为表前缀 $table = (string) current($join) . $table; - } else { + } elseif (false === strpos($table, '.')) { // 加上默认的表前缀 $table = $prefix . $table; } @@ -357,7 +357,7 @@ class Query $join = trim($join); if (0 === strpos($join, '__')) { $table = $this->connection->parseSqlTable($join); - } elseif (false === strpos($join, '(') && !empty($prefix) && 0 !== strpos($join, $prefix)) { + } elseif (false === strpos($join, '(') && false === strpos($join, '.') && !empty($prefix) && 0 !== strpos($join, $prefix)) { // 传入的表名中不带有'('并且不以默认的表前缀开头时加上默认的表前缀 $table = $prefix . $join; } else {