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

80酷酷网    80kuku.com

  <?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中所有的属性和方法
?>













分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: