改进Model类的getData方法

This commit is contained in:
thinkphp
2016-05-18 11:01:49 +08:00
parent 198ea76923
commit fdd41cd1c7
2 changed files with 21 additions and 21 deletions

View File

@@ -163,7 +163,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
*/
public function getData($name = '')
{
return isset($this->data[$name]) ? $this->data[$name] : $this->data;
return array_key_exists($name, $this->data) ? $this->data[$name] : $this->data;
}
/**