宝哥软件园

php反射应用示例

编辑:宝哥软件园 来源:互联网 时间:2021-11-10

复制代码代码如下:phpffunction custom(){ } class custom { public function index(){ } } print _ r(get _ define _ position(' custom '));/* * * */* @ param字符串$name函数名或者类名* @返回数组*/函数get _ define _ position($ name){ $ info=array();if(class _ exists($ name)){ $ ob=new ReflectionClass($ name);$info['class_ ' .$name]=数组(' file'=$ob-getFileName(),' line '=$ ob-getStartLine());} if(function _ exists($ name)){ $ ob=new ReflectionFunction($ name);$info['function_ ' .$name]=数组(' file'=$ob-getFileName(),' line '=$ ob-getStartLine());}返回$ info}

更多资讯
游戏推荐
更多+