php5 反射refection 的用途

php中的反射api由一系列可以分析属性,方法和类的内置类组成。利用这些反射API中的类,可以在运行时访问对象。函数和脚本中的扩展的信息。

主要用途:

            1) 由于反射API能够输出很多类,方法等相关的内部信息,所以很方便当做类测试的工具;

             2)根据命名规则创建一个调用模板类中方法的框架

主要的Api:

Reflection {}
Reflector {}
ReflectionFunctionAbstract implements Reflector {}
ReflectionClass implements Reflector {}
ReflectionExtension implements Reflector {}
ReflectionFunction extends ReflectionFunctionAbstract implements Reflector {}
ReflectionMethod extends ReflectionFunctionAbstract implements Reflector {}
ReflectionObject extends ReflectionClass implements Reflector {}
ReflectionParameter implements Reflector {}
ReflectionProperty implements Reflector {}
ReflectionException extends Exception {}
 
posted on 2012-09-09 15:06  mingaixin  阅读(365)  评论(0编辑  收藏  举报