各位高手帮忙看看这段代码为什么会出现这样的问题?? $this->name = "Clone of".that->name; that ????? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php class ObjectTracker //对象跟踪器 { private static $nextSerial = 0; private $id; private $name; function __construct($name) //构造函数 { $this->name = $name; $this->id = ++self::$nextSerial; } function __clone() //克隆 { $this->name = "Clone of".$this->name; $this->id = ++self::$nextSerial; } function getId() //获取id属性的值 { return($this->id); } function getName() //获取name属性的值 { return($this->name); } } $ot = new ObjectTracker("Zeev's Object"); $ot2 = clone$ot; //输出: 1 Zeev's Object print($ot->getId() . " " . $ot->getName() . "<br>"); //输出: 2 Clone of Zeev's Object print($ot2->getId() . " " . $ot2->getName() . "<br>"); ?> 谢谢哦,这样的话什么时候用that呢? no "that" in php system , it is programing , not speaking in English . windows7配置wamp环境后localhost出现403禁止访问 如何检查页面URL中是否有某个字符串? ajax的问题 SQL语句求助 一个PHP的问题 思考很久了 请高手帮忙 能否用Post方法提交label控件的innerHTML或innerText值? 奇怪问题 max函数识别不了参数 我想给每个值,都添加一个元素c => 3,有没有系统函数啊 thinkphp 做个下次自动登陆的列子 求助,php怎么在不改变分辨率的情况下更大的压缩png格式的图片啊 这个类有什么问题啊 一个表单提交三个不同页面出现的问题
class ObjectTracker //对象跟踪器
{
private static $nextSerial = 0;
private $id;
private $name; function __construct($name) //构造函数
{
$this->name = $name;
$this->id = ++self::$nextSerial;
} function __clone() //克隆
{
$this->name = "Clone of".$this->name;
$this->id = ++self::$nextSerial;
} function getId() //获取id属性的值
{
return($this->id);
} function getName() //获取name属性的值
{
return($this->name);
}
} $ot = new ObjectTracker("Zeev's Object");
$ot2 = clone$ot; //输出: 1 Zeev's Object
print($ot->getId() . " " . $ot->getName() . "<br>"); //输出: 2 Clone of Zeev's Object
print($ot2->getId() . " " . $ot2->getName() . "<br>");
?>