这是我的代码:
notifyDataSetChanged
此代码打印$ a和$ b 有没有办法获取类属性而不获取继承的父类属性。
答案 0 :(得分:1)
foreach ($refclass->getStaticProperties() as $key => $property)
if ($refclass->getProperty($key)->getDeclaringClass() == $refclass) {
echo $key;
}
}
或者,也许更优雅:
$props = array_filter($refclass->getProperties(ReflectionProperty::IS_STATIC), function ($prop) use ($refclass) {
return $prop->getDeclaringClass() == $refclass;
});