PHP 从映象(Reflection)类中读取属性信息
<?php/**
从映象(Reflection)类中读取属性信息
用该方法可以查看指定类中的方法和属性
*/
include_once'mycal.php';//一个类文件或采用系统中的类如Exception
$obj=newReflectionClass('myCal');
//$obj=newReflectionClass(Exception);
$arr=$obj->getMethods();//取得类中所有的名字
//$arr=$obj->getMethod('Calendar');//取得指定类的名字
//$arr=ReflectionClass::getMethod('myCal');
print_r($arr);
//Reflection::export(newReflectionClass('ReflectionClass'));//通过此方法可以看到ReflectionClass中所有的属性和方法
?>
页:
[1]