PHP ReflectionClass 反射类

作者: 分类: php 时间: 2017-07-30 评论: 暂无评论
$reflection = new \ReflectionClass($moduleName);  //new 一个反射类ReflectionClass
$reflection->hasMethod($actionName))  //是否存在$actionName 方法
$method = $reflection->getMethod($actionName);  //new 一个反射方法类  ReflectionMethod
$handle = $reflection->newInstance(); //new 一个$moduleName
data = $method->invokeArgs($handle, array($param)); //调用方法