PHP中父类与子类的晚期绑定/延迟绑定
时间:2021-07-01 10:21:17
帮助过:6人阅读
PHP中父类与子类的后期绑定/延迟绑定
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- class Human {
- public static function whoami() {
- echo '来自父类的whoami在执行
'; - }
-
- public static function say() {
- self::whoami();
-
- }
-
- public static function say2() {
- static::whoami();
-
-
- }
- }
-
-
- class Stu extends Human{
-
-
-
-
-
- }
-
-
- Stu::say();
-
- Stu::say2();