From 87a128f231e50bca44bf445494ea18975348973b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Apr 2016 18:16:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84order?= =?UTF-8?q?=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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index d042b8a2..c327ffae 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -610,8 +610,12 @@ class Query $field = empty($order) ? $field : [$field => $order]; } elseif (!empty($this->options['via'])) { foreach ($field as $key => $val) { - $field[$this->options['via'] . '.' . $key] = $val; - unset($field[$key]); + if (is_numeric($key)) { + $field[$key] = $this->options['via'] . '.' . $val; + } else { + $field[$this->options['via'] . '.' . $key] = $val; + unset($field[$key]); + } } } $this->options['order'] = $field;