是否可以像这样捕获对静态参数的调用:
class foo
{
public static $foo = 1;
//public static $bar = 2;
public function catch_bar_call()
{
print "Calling an undefined property";
}
}
print foo::$foo //1
print foo::$bar //error
而不是得到一个错误,我想要一个方法被调用。我知道它可能通过 __get() 魔术方法,但你必须为此实例化你的类,这在静态参数上是不可能的。