我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

GetAll私人成员ZendFramework

Is there a way to list all private member of an instance with Zend\Server\Reflection?

The documentation for this class is very light I can't get any way to do that.

This class is using php ReflectionClass internally. You can do like this:

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

I tested in ZF2 version 2.5.1 and there it works...

近期文章

  • 从套接字输出文本的安全方法。
  • 使用动态字段组管理表单
  • 发出使会话变量起作用的问题
  • php保存的文件下载不是预期的
  • 缺少Symfony2 Bundles资源文件
  • 使用ajax调用更新数据库onclick
  • 安全登录表单,或者至少我希望如此
  • 没有从在线服务器获得json响应
  • 无法通过PHP和MySQL获得接受的请求
  • 尝试获取行数时,PDO上的fetchColumn错误
  • 保存HTML5将元素拖放到db
  • 使用搜索字词更改codeigniter中的网址
  • 使用ajax,PHP和Javascript循环访问JSON文件
  • 基于HTML的更新查询选择选项阵列PHP
  • 如何在PHP中同时运行多个函数
  • Sublime Text自动完成功能,括号中是否有变量?
  • 为什么在多次加载页面时会破坏PHP会话?
  • Php JSONArray解码并执行数据库操作
  • 减少在php中使用$ this伪变量?
  • php论坛登录抛出错误[重复]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华