【发布时间】:2011-10-24 04:39:47
【问题描述】:
可能的重复:
Calling non static method with "::"
Does static method in PHP have any difference with non-static method?
考虑到我们不尝试使用 $this 访问对象上下文中的任何内容,允许使用 :: 调用非静态方法的原因是什么?它是向后兼容的东西,还是出于某种特殊原因?我应该习惯避免使用 :: 来访问非静态方法吗?
class Foo{
public function Bar(){
echo "this works just fine";
}
}
Foo::Bar();
【问题讨论】:
标签: php scope-resolution