GetAll 私有成员 ZendFramework

GetAll private member ZendFramework

有没有办法列出具有 Zend\Server\Reflection 的实例的所有私有成员?

The documentation for this class很轻 我没办法做到这一点。

此 class 正在内部使用 php ReflectionClass。你可以这样做:

$reflection = \Zend\Server\Reflection::reflectClass($className);
$properties = $reflection->getProperties();
$propertyNames = array();
foreach($properties as $property){
    if($property->isPrivate()){
        $propertyNames[] = $property->getName();
    }
}
var_dump($propertyNames);

我在 ZF2 版本 2.5.1 中进行了测试,它可以正常工作...