首頁  >  文章  >  php教程  >  PHP Entity

PHP Entity

PHP中文网
PHP中文网原創
2016-05-25 17:13:101449瀏覽

跳至

_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();

                   

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn