From 2c03514d98d55847e379957b1934a1449e90f30a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 23 Dec 2016 14:47:28 +0800 Subject: [PATCH] =?UTF-8?q?Query=E7=B1=BB=E7=9A=84order=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E6=AC=A1=E8=B0=83=E7=94=A8=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 116b7070..e2f9ef7a 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -1181,7 +1181,14 @@ class Query } } } - $this->options['order'] = $field; + if (!isset($this->options['order'])) { + $this->options['order'] = []; + } + if (is_array($field)) { + $this->options['order'] = array_merge($this->options['order'], $field); + } else { + $this->options['order'][] = $field; + } } return $this; }