From 38b21f25baac39147770b9b72f0a761a45422d6d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 9 Oct 2016 15:39:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96join=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index ec37e49d..0ba4b3c7 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -663,38 +663,19 @@ class Query } } } else { - $prefix = $this->prefix; // 传入的表名为数组 if (is_array($join)) { - if (count($join) > 1) { - $prefix = array_pop($join); - } if (0 !== $key = key($join)) { // 设置了键名则键名为表名,键值作为表的别名 $table = $key; - if (false === strpos($table, '.')) { - $table = $prefix . $table; - } $alias = array_shift($join); $this->alias([$table => $alias]); $table = [$table => $alias]; } else { $table = array_shift($join); - if (false === strpos($table, '.')) { - $table = $prefix . $table; - } } - } else { - $join = trim($join); - if (0 === strpos($join, '__')) { - $table = $this->parseSqlTable($join); - } elseif (false === strpos($join, '(') && false === strpos($join, '.') && !empty($prefix) && 0 !== strpos($join, $prefix)) { - // 传入的表名中不带有'('并且不以默认的表前缀开头时加上默认的表前缀 - $table = $prefix . $join; - } else { - $table = $join; - } + $table = trim($join); if (strpos($table, ' ')) { list($table, $alias) = explode(' ', $table); $this->alias([$table => $alias]);