您的位置:首页 > 编程语言 > PHP开发

PHP 从映象(Reflection)类中读取属性信息

2007-04-01 23:53 267 查看
 


<?php


/**


    从映象(Reflection)类中读取属性信息


    用该方法可以查看指定类中的方法和属性    


*/


include_once 'mycal.php';//一个类文件或采用系统中的类如Exception


$obj = new ReflectionClass('myCal');


//$obj = new ReflectionClass(Exception);


$arr = $obj->getMethods();//取得类中所有的名字


//$arr = $obj->getMethod('Calendar');//取得指定类的名字


//$arr = ReflectionClass::getMethod('myCal');


print_r($arr);


//Reflection::export(new ReflectionClass('ReflectionClass'));//通过此方法可以看到ReflectionClass中所有的属性和方法


?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息