摘要:
由于PHP是动态脚本语言,故而反射的作用变得那么不明显了,但基于习惯,首先还是来攻克反射。 废话不多上,上基本的反射class A{ public $one = 'one'; public $two = 'two'; } $a = new A(); $reflector = new ReflectionClass($a); $properties = $reflector->getProperties(); foreach($properties as $property) { if($property->getName()=='two 阅读全文