取得类的 对象属性名 和类的属性 和类的方法名

 



get_object_vars — 返回由对象属性组成的关联数组
array get_object_vars ( object $obj )
get_class_vars — 返回由类的默认属性组成的数组
array get_class_vars ( string $class_name )

$class_methods get_class_methods(new myclass());

foreach ($class_methods as $method_name) {
    echo "$method_name ";
}

// create an object
$bar = new foo();

// external call
echo "Its name is " get_class($bar) , " ";

// internal call
$bar->name();

?>

Its name is foo
原文地址:https://www.cnblogs.com/ldms/p/8316349.html