ReflectionClass
作者:互联网
文档地址
https://www.php.cn/php-weizijiaocheng-452063.html
- 多用于
- 自动生成文档
- 实现 MVC 架构
- 实现单元测试
- 配合 DI 容器解决依赖
- 使用反射类
-
ReflectionClass
-
$rfc = new \ReflectionClass($obj);
- ReflectionClass::getProperties — 获取一组属性
-
ReflectionProperty
-
$rfc->getProperties(\ReflectionProperty::IS_PUBLIC)
3.判断属性是否是静态
4.获取属性的值
5.获取属性名称
6.设置属性访问
setAccessible
标签:反射,ReflectionClass,获取,ReflectionProperty,php,属性 来源: https://www.cnblogs.com/phpjason/p/16152252.html