From 669f70acf0947c6ac99633a3d695e6ad0dc18749 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 7 Feb 2017 22:32:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=85=B3=E8=81=94=E7=94=A8?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index d4db7813..c9389356 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1492,11 +1492,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 支持闭包查询过滤关联条件 $closure = $relation; $relation = $key; - } elseif (is_array($relation)) { + } + if (is_array($relation)) { $subRelation = $relation; $relation = $key; - } - if (strpos($relation, '.')) { + } elseif (strpos($relation, '.')) { list($relation, $subRelation) = explode('.', $relation, 2); } $method = Loader::parseName($relation, 1, false); @@ -1522,7 +1522,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $closure = $relation; $relation = $key; } - if (strpos($relation, '.')) { + if (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (strpos($relation, '.')) { list($relation, $subRelation) = explode('.', $relation, 2); } $relation = Loader::parseName($relation, 1, false); @@ -1548,7 +1551,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $closure = $relation; $relation = $key; } - if (strpos($relation, '.')) { + if (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (strpos($relation, '.')) { list($relation, $subRelation) = explode('.', $relation, 2); } $relation = Loader::parseName($relation, 1, false);