From 7e0282081d312b13120136ca4802068040bed71b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 Jan 2017 21:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84allowF?= =?UTF-8?q?ield=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E9=80=97=E5=8F=B7=E5=88=86=E9=9A=94=E5=AD=97=E7=AC=A6=E4=B8=B2?= 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 ebc84abd..eb01a3f6 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -936,11 +936,14 @@ abstract class Model implements \JsonSerializable, \ArrayAccess /** * 设置允许写入的字段 * @access public - * @param bool|array $field 允许写入的字段 如果为true只允许写入数据表字段 + * @param mixed $field 允许写入的字段 如果为true只允许写入数据表字段 * @return $this */ public function allowField($field) { + if (is_string($field)) { + $field = explode(',', $field); + } $this->field = $field; return $this; }