From 5981a54c4061a4a92587d53ebe1304df0bf053ae Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 Jan 2017 12:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E5=9E=8B=E7=B1=BB?= =?UTF-8?q?=E7=9A=84allowField=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 3455b4a8..cfd404ad 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -755,6 +755,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 检测字段 if (!empty($this->field)) { + if (true === $this->field) { + $this->field = $this->db(false)->getTableInfo('', 'fields'); + } foreach ($this->data as $key => $val) { if (!in_array($key, $this->field)) { unset($this->data[$key]); @@ -938,9 +941,6 @@ abstract class Model implements \JsonSerializable, \ArrayAccess */ public function allowField($field) { - if (true === $field) { - $field = $this->db(false)->getTableInfo('', 'fields'); - } $this->field = $field; return $this; }