From 173fec766f32fb006a44fd926c13d6e549b79916 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 21 Jun 2016 14:12:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84toarra?= =?UTF-8?q?y=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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index d51160d0..7b7fc3f1 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -450,7 +450,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if ($val instanceof Model || $val instanceof Collection) { // 关联模型对象 $item[$key] = $val->toArray(); - } elseif (is_array($val) && isset($val[0]) && $val[0] instanceof Model) { + } elseif (is_array($val) && reset($val) instanceof Model) { // 关联模型数据集 $data = []; foreach ($val as $k => $value) {