Heim  >  Artikel  >  php教程  >  PHP Entity

PHP Entity

PHP中文网
PHP中文网Original
2016-05-25 17:13:101452Durchsuche

跳至

_email;
	}

	public function setEmail($val)
	{
		$this->_email = $val;
		return $this;
	}

	public function getComment()
	{
		return $this->_comment;
	}

	public function setComment($val)
	{
		$this->_comment = $val;
		return $this;
	}
}
class Test
{

	public function save(Entity $guestbook)
	{
		$data = array(
				'email' => $guestbook->getEmail(),
				'comment' => $guestbook->getComment(),
				'created' => date('Y-m-d H:i:s'));
		$this->data = $data;
		return $this;
	}

	public function show()
	{
		print_r($this->data);
	}
}
$param = new Entity();
$param->setEmail('xxx@163.com')->setComment("说撒");
$t = new Test();
$t->save($param)->show();

                   

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn