我试图在不需要子类的功能的情况下完成这个...这可能吗?我有一种感觉它不是,但我真的想确定...
<?php
class A {
public static function who() {
echo __CLASS__;
}
public static function test() {
static::who(); // Here comes Late Static Bindings
}
}
class B extends A {
public static function who() {
echo __CLASS__;
}
}
B::test(); //returns B
?>
Run Code Online (Sandbox Code Playgroud)