如何解决static :: call不可用时?

时间:2012-08-28 12:28:56

标签: php static late-static-binding

我的服务器上有一个php 5.2(无法更新),它会在static::routin()调用时丢失错误。怎么解决?无论如何,有没有办法检测这种类型的呼叫是否可用,以便可以添加智能呼叫机制?

1 个答案:

答案 0 :(得分:1)

后期静态绑定仅适用于PHP 5.3。要在5.2版中获取被调用的类名,您必须使用解决方法。

From the manual

As of PHP 5.3.0, PHP implements a feature called late static bindings which can be used to reference the called class in a context of static inheritance.

One work around exists here