可能重複:
Magic __get getter for static properties in PHPPHP抓調用靜態參數
是否有可能趕上調用這樣的靜態參數:
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()魔術方法,但你必須爲此類實例化你的類,而不是靜態參數。
我看到它,也許有人知道一個解決方案... –