各位高手帮忙看看这段代码为什么会出现这样的问题?? $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 . PHP读取TXT文件插入数据库 新手求助.php上传总是 invalid file ecshop后台商品输入框 mysql 保留字问题 碰到了问题求救 没有思路了 帮忙发一份最新的smarttemplate模板及examples给我好吗? PHP有没有O/R Mapping的解决方案? 有人会用 “一个功能极其强大的PHP树类 ”了吗? 哪位晓得大型网站信息采编系统的技术内幕? 各位大蝦好呵! 先問一下, php 中怎樣用imap函數將一封新郵件標識成已讀 ?還有imap_setflag_full具體怎樣用。。? 这个类有什么问题啊 一个表单提交三个不同页面出现的问题
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>");
?>