From cda738b03856d679cfae76885f776721f22cbc71 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 17 May 2016 22:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84destro?= =?UTF-8?q?y=E6=96=B9=E6=B3=95=20=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=88=A0=E9=99=A4=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index cb04724c..03b52e46 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -639,7 +639,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess public static function destroy($data) { $db = self::db(); - if ($data instanceof \Closure) { + if (is_array($data) && key($data) !== 0) { + $db->where($data); + $data = []; + } elseif ($data instanceof \Closure) { call_user_func_array($data, [ & $db]); $data = []; }