abstract class Mage_Core_Model_Mysql4_Abstract extends Mage_Core_Model_Resource_Abstract
{
.
.
.
方法省略 protected function _afterDelete(Mage_Core_Model_Abstract $object)
{
return $this;
}
}
$this在php都有些什么作用??
除了调用本类方法/变量意外还有吗?
此段程序的$this返回的是下面的哪个类???理由是什么。帮忙研究下吧,从来没遇到这种返回方式,谢谢。
1,Mage_Core_Model_Mysql4_Abstract
2,Mage_Core_Model_Resource_Abstract
3,Mage_Core_Model_Abstract
{
.
.
.
方法省略 protected function _afterDelete(Mage_Core_Model_Abstract $object)
{
return $this;
}
}
$this在php都有些什么作用??
除了调用本类方法/变量意外还有吗?
此段程序的$this返回的是下面的哪个类???理由是什么。帮忙研究下吧,从来没遇到这种返回方式,谢谢。
1,Mage_Core_Model_Mysql4_Abstract
2,Mage_Core_Model_Resource_Abstract
3,Mage_Core_Model_Abstract
起不是没有任何输出???
{
function abc()
{
echo $this;
}
}
a::abc();//空,因为$this无所指。
$a = new a();
$a->abc();//object,因为$this相当于$a的内部指针。
Catchable fatal error: Object of class a could not be converted to string in /var/www/duixiang.php on line 6
大概就是那个意思.
class a
{
public $name = 'hello world!';
function abc()
{
if($this) echo $this->name;
}
}
a::abc();//空,因为$this无所指。
$a = new a();
$a->abc();//hello world,因为$this相当于$a的内部指针。