在php中调用父静态方法 [英] Call parent static method in php
本文介绍了在php中调用父静态方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个基类A:
class A {
public static function a() {
...
}
public static function b() {
...
}
}
和扩展类B
class B extends A {
public static function a() {
...
}
public static function c() {
...
}
}
我希望能够使用B ::
调用所有方法如何调用A :: b,使用B ::?
I would like to be able to call all the methods using B:: How would I call A::b, using B::?
推荐答案
您应该能够轻松完成此操作:
You should be able to accomplish this as easily as:
class B extends A {
public static function a() {
parent::a();
}
}
这篇关于在php中调用父静态方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文