php中$this->name 是啥意思?
<?phpclassMyDestructableClass{function__construct(){print"Inconstructor\n";$this->nam...
<?php
class MyDestructableClass {
function __construct() {
print "In constructor\n";
$this->name = "MyDestructableClass";
}
function __destruct() {
print "Destroying " . $this->name . "\n";
}
}
$obj = new MyDestructableClass();
?>
///////////////////////////////////////////
就像 上面那样:
$this->name="mydestrucatableClass";
print "destroying" . $this->name ."\n";
这俩 $this->name 是做什么用途的? 有无区别? 展开
class MyDestructableClass {
function __construct() {
print "In constructor\n";
$this->name = "MyDestructableClass";
}
function __destruct() {
print "Destroying " . $this->name . "\n";
}
}
$obj = new MyDestructableClass();
?>
///////////////////////////////////////////
就像 上面那样:
$this->name="mydestrucatableClass";
print "destroying" . $this->name ."\n";
这俩 $this->name 是做什么用途的? 有无区别? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询