(PHP 5)
ReflectionClass::getProperties — دریافت خاصیتها
دریافت خاصیتهای بازتابی.
This function is currently not documented; only its argument list is available.
فیلتر اختیاری برای فیلتر کردن انواع دلخواه فیلتر. با استفاده از ثابتهای ReflectionProperty و پیشفرضهای تمام خاصیتها تنظیم شده است.
آرایه اشیا ReflectionProperty.
Example #1 مثال فیلترReflectionClass::getProperties()
این مثال استفاده اختیاری از پارامتر filter را نشان میدهد که از خاصیتهای خصوصی استفاده نمیکند.
<?php
class Foo {
public $foo = 1;
protected $bar = 2;
private $baz = 3;
}
$foo = new Foo();
$reflect = new ReflectionClass($foo);
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
foreach ($props as $prop) {
print $prop->getName() . "\n";
}
var_dump($props);
?>
The above example will output something similar to:
foo bar array(2) { [0]=> object(ReflectionProperty)#3 (2) { ["name"]=> string(3) "foo" ["class"]=> string(3) "Foo" } [1]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "Foo" } }