_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();
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号