class Student{
private $_name;
private $_age;
private $_male;
public function __construct($name,$age,$male){
$this->_name=$name;
$this->_age=$age;
$this->_male=$male;
}
public function __toString(){
return $this->_name.','.$this->_age.','.$this->_male;
}
}
$stu= new Student('小龙女',18,'女');
echo $stu;
?>
面向对象对象转字符串
最新推荐文章于 2022-10-14 07:30:00 发布