<?php
//设置编码格式
header("Content-type: text/html; charset=utf-8");
class ren{
private $name;
private $age;
private $sex;
public function __construct($name,$age,$sex){
$this->name=$name;
$this->age=$age;
$this->sex=$sex;
}
public function info(){
echo "我的名字是:".$this->name."<br/>";
echo "我的年龄是:".$this->age."<br/>";
echo "我的性别是:".$this->sex."<br/>";
}
}
$tom=new ren('小张',15,'女');
$tom->info();
echo "<hr/>";
$jim=clone $tom;
$jim->info();
?> 最佳答案