From 0b8327d135adbd25a4493090182451d8bd3dd851 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 10 Oct 2016 10:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 0ba4b3c7..3ca3382d 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -667,10 +667,8 @@ class Query if (is_array($join)) { if (0 !== $key = key($join)) { // 设置了键名则键名为表名,键值作为表的别名 - $table = $key; - $alias = array_shift($join); - $this->alias([$table => $alias]); - $table = [$table => $alias]; + $table = [$key => array_shift($join)]; + $this->alias($table); } else { $table = array_shift($join); } @@ -678,8 +676,8 @@ class Query $table = trim($join); if (strpos($table, ' ')) { list($table, $alias) = explode(' ', $table); - $this->alias([$table => $alias]); - $table = [$table => $alias]; + $table = [$table => $alias]; + $this->alias($table); } } $this->options['join'][] = [$table, strtoupper($type), $condition];