From 514dc8c3009ec44484d85e17d24b006a8a4606b4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Apr 2016 08:44:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BgetData=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=8E=B7=E5=8F=96=E6=9F=90=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=80=BC?= 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 b43cc4c1..8cccb983 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -163,11 +163,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess /** * 获取对象原始数据 * @access public + * @param string $name 字段名 留空获取全部 * @return array */ - public function getData() + public function getData($name = '') { - return $this->data; + return isset($this->data[$name]) ? $this->data[$name] : $this->data; } /**