duanliu8998 2010-06-30 09:32
浏览 26
已采纳

有没有办法获得关于PHP OOPS中的函数的类名和文件名的信息

i m learning OOPS with JOOMLA... here sometimes i found difficulties to find the method used in some class... is there any way to find that this function is declared on this class or useful information about that function??

for exmaple

class testModeltest extends JModel
{
     function modifyCategory($data = array())

{ $image = $this->imageResize($value); ....... } }

now i want to know where the imageResize() function declared/defined first time...means class and file name where this function born

i used magic constact __METHOD__ this retrive useful information inside class . i need such type of function where i just put method name & i get the complete information of that function

i want a below kind of facility( i m sure there are some function in php to get the information about class but don't know )

functionInfo($methodname) // here i just put the function name

 which return

  Function Name:imageResize
  Main class : imageclass
  File name where it has been declared : /foldername/filename.php
  currenty using(called) in : thisclass::this function
  • 写回答

1条回答 默认 最新

  • drep94225 2010-06-30 10:19
    关注

    If you are looking for the place where a method was first defined, that should be possible using get_parent_class() - here is a snippet that walks through each class definition - and doing a method_exists() on each class found that way.

    However, this will not show where the method has been subsequently overriden, so it may be of limited use to you - in that case, something like Reflection is probably indeed the only way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程