21,891
社区成员
发帖
与我相关
我的任务
分享
class A
{
function foo()
{
if (isset($this)) { //这里的$this指的是类的对象吗?
echo '$this is defined (';
echo get_class($this);
echo ")\n";
} else {
echo "\$this is not defined.\n";
}
}
}
$a = new A();
$a->foo(); //输出$this is defined (A)
echo '<br>';
A::foo(); //$this is not defined
A::foo()跟$a->foo() 调用的方法都一样,为什么输出来却不一样? printf('%0.16f', (0.1+0.7) * 10 ); // 7.9999999999999991