From cf4415e9d9c7366e338f1fa981fa730488331b63 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 30 Sep 2016 17:08:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=85=B3=E8=81=94=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=9A=84=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index c276d872..edd65bf4 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -407,9 +407,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 类型转换 $value = $this->readTransform($value, $this->type[$name]); } elseif ($notFound) { - if (method_exists($this, $name) && !method_exists('\think\Model', $name)) { + $method = Loader::parseName($name, 1); + if (method_exists($this, $method) && !method_exists('\think\Model', $method)) { // 不存在该字段 获取关联数据 - $value = $this->relation()->getRelation($name); + $value = $this->relation()->getRelation($method); // 保存关联对象值 $this->data[$name] = $value; } else {