手机版

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}

版权声明:php反射应用示例是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。