<?php //利用后期静态绑定技术,实现在父类调用子类中重写的静态成员 //创建父类 class Father { public static $price=5000; public static function getClass() { return __CLASS__; } public static function getPrice() { return static::getClass().':'.static::$price; } } //创建子类 class Son extends Father { public static $price=8000; public static function getClass() { return __CLASS__; } } echo Father::$price,'<br>'; echo Father::getClass(),'<br>'; echo Son::$price,'<br>'; echo Son::getClass(),'<br>'; echo Son::getPrice();