ReflectionClass
PHP Manual

ReflectionClass::getStaticPropertyValue

(PHP 5 >= 5.1.0)

ReflectionClass::getStaticPropertyValueGets static property value

说明

public mixed ReflectionClass::getStaticPropertyValue ( string $name )

Gets the value of a static property on this class.

参数

name

The name of the static property for which to return a value.

返回值

The value of the static property.

范例

Example #1 Basic usage of ReflectionClass::getStaticPropertyValue()

<?php
class Apple {
    public static 
$color 'Red';
}

$class = new ReflectionClass('Apple');
var_dump($class->getStaticPropertyValue('color'));
?>

以上例程会输出:

string(3) "Red"

参见


ReflectionClass
PHP Manual