From cbfa98341bd5e6e8117edd1ed590e117fe7c7118 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 20 Sep 2016 17:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84save?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20=E4=BF=AE=E6=AD=A3=E4=B8=8D=E6=8C=89?= =?UTF-8?q?=E4=B8=BB=E9=94=AE=E6=9F=A5=E8=AF=A2=E7=9A=84=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/think/Model.php b/library/think/Model.php index 1a9696b6..276f4770 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -667,6 +667,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if (!empty($where)) { $pk = $this->getPk(); if (is_string($pk) && isset($data[$pk])) { + if (!isset($where[$pk])) { + unset($where); + $where[$pk] = $data[$pk]; + } unset($data[$pk]); } }