$this->dtp = new DedeTagParse();$this->dtp->refObj = $this;我想問一下$this->dtp->refObj = $this是什么意思啊,是把當前值賦給以往的變量嗎,不懂,請各位大俠幫幫忙!謝謝?。╬hp初學者)
1 回答

慕姐4208626
TA貢獻1852條經驗 獲得超7個贊
$this 指的是當前類的實例指針
$this->dtp = new DedeTagParse();
$this->dtp->refObj = $this;
意思是當前類和DedeTagParse用各自的一個變量相互指向對方,只是變量的名字不一樣
當前類用的是dtp 而DedeTagParse ($this->dtp)用的是refObj
DedeTagParse這個類的實例保存了當前類的實例指針, 當前類的實例指針通過成員變量($this->dtp)保存了DedeTagParse這個類的實例對象
$this->dtp 指向 new DedeTagParse
new DedeTagParse($this->dtp)的refObj 指向 $this
- 1 回答
- 0 關注
- 255 瀏覽
添加回答
舉報
0/150
提交
取消