class="baidu_pl"> class="article_content clearfix"> class="htmledit_views"> class="class="tags" href="/tags/PHP.html" title=php>php"><?class="tags" href="/tags/PHP.html" title=php>php class Foo { public static $my_static = '静1'; public class="tags" href="/tags/FUNCTION.html" title=function>function staticValue() { return self::$my_static; } } class Bar extends Foo { public static $my_static = '静2'; public class="tags" href="/tags/FUNCTION.html" title=function>function fooStatic() { return parent::$my_static; } } print Foo::$my_static . "<br />";//1 $foo = new Foo(); print $foo->staticValue() . "<br />";//2 //print $foo->my_static . "<br />"; // Undefined "Property" my_static print $foo::$my_static . "<br />";//3 $classname = 'Foo'; print $classname::$my_static . "<br />"; // PHP 5.3.0之后可以动态调用3 print Bar::$my_static . "<br />";//4 $bar = new Bar(); print $bar->fooStatic() . "<br />";//5 ?>