_attributes)), 'safe'), ); } public function attributeNames() { // 返回属性名称 return array_keys($this->_attributes); } public function __get($name) { // 获取属性值 if (array_key_exists($name, $this->_attributes)) { return $this->_attributes[$name]; } else { return parent::__get($name); } } public function __set($name, $value) { // 设置属性值 $this->_attributes[$name] = $value; } public function setAttributes($values, $safeOnly = true) { // 批量设置属性值 if (!is_array($values)) { return; } foreach ($values as $name => $value) { $this->$name = $value; } } }