From 7a6ece32443aed49cb071a09a9a1299e985ea1be Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 18 Jul 2021 16:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=85=B3=E8=81=94=E7=9A=84wi?= =?UTF-8?q?thoutfield=E6=96=B9=E6=B3=95=E5=8F=82=E6=95=B0=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/Relation.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/model/Relation.php b/src/model/Relation.php index 0bd33d4a..1779896d 100644 --- a/src/model/Relation.php +++ b/src/model/Relation.php @@ -245,11 +245,15 @@ public function withField(array $field) /** * 排除关联数据的字段 * @access public - * @param array $field 关联字段限制 + * @param array|string $field 关联字段限制 * @return $this */ - public function withoutField(array $field) + public function withoutField($field) { + if (is_string($field)) { + $field = array_map('trim', explode(',', $field)); + } + $this->withoutField = $field; return $this; }