From e562cb4080158c0cd76e07f7275a828cb72b4f7f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 17 Sep 2016 11:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bmodel=E7=B1=BBsave=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=AF=B9=E5=AD=97=E6=AE=B5=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index f1c91582..47f90d47 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -631,9 +631,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 检测字段 if (!empty($this->field)) { - $this->db(); foreach ($this->data as $key => $val) { - if (!in_array($key, $this->field)) { + if (!in_array($key, $this->field) && !array_key_exists($key, $this->field)) { unset($this->data[$key]); } }