php 子类如何访问父类的静态方法

1.子类内部访问父类静态成员属性或方法,使用 parent::method()/self::method() 注意:$this->staticProperty(父类的静态属性不能够经过$this(子类实例)来访问,会有这样报错:PHP Strict Standards: Accessing static property Person::$country as non static in,PHP Notice: Undefined property: ) 2.子类外部 1.子类名::method() 2.子类实例->method() (静态方法也能够经过普通对象的方式访问) 注意:子类实例->staticProperty(父类的静态属性不能够经过子类实例来访问,会有这样报错:PHP Strict Standards: Accessing static property Person::$country as non static in,PHP Notice: Undefined property: )this

相关文章
相关标签/搜索