ReflectionClass::getStaticPropertyValue

(PHP 5 >= 5.1.2, PHP 7)

ReflectionClass::getStaticPropertyValue锟斤拷取锟斤拷态锟斤拷static锟斤拷锟斤拷锟皆碉拷值

说锟斤拷

public ReflectionClass::getStaticPropertyValue ( string $name [, mixed &$def_value ] ) : mixed

锟斤拷取锟斤拷锟斤拷锟斤拷锞蔡拷锟絪tatic锟斤拷锟斤拷锟皆碉拷值锟斤拷

锟斤拷锟斤拷

name

锟斤拷态锟斤拷锟皆碉拷锟斤拷锟狡o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值锟斤拷

def_value

锟斤拷锟斤拷锟斤拷没锟叫讹拷锟斤拷 name 锟斤拷 static 锟斤拷锟皆o拷锟斤拷锟斤拷锟斤拷一锟斤拷默锟斤拷值锟斤拷 锟斤拷锟斤拷锟斤拷圆锟斤拷锟斤拷冢锟斤拷锟斤拷锟绞★拷锟斤拷舜瞬锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷壮锟� ReflectionException 锟斤拷

锟斤拷锟斤拷值

锟斤拷态锟斤拷锟皆碉拷值锟斤拷

锟斤拷锟斤拷

Example #1 ReflectionClass::getStaticPropertyValue() 锟侥伙拷锟斤拷锟矫凤拷

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

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

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

string(3) "Red"

锟轿硷拷