在PHP中,可以使用self::关键字来调用静态属性。例如:
class Example { public static $staticProperty = "Static Property"; public function getStaticProperty() { return self::$staticProperty; }}echo Example::$staticProperty; // 输出 "Static Property"$example = new Example();echo $example->getStaticProperty(); // 输出 "Static Property"在上面的示例中,我们使用self::$staticProperty来调用静态属性$staticProperty。无论是在类的内部还是外部,都可以使用self::关键字来访问静态属性。


