Maison  >  Article  >  développement back-end  >  php 如何查看某个函数定义在 那个php文件中

php 如何查看某个函数定义在 那个php文件中

PHP中文网
PHP中文网original
2017-03-30 15:20:192944parcourir


如何查看某段php脚本中出现的函数是在那个php文件中定义的

使用ReflectionFunction。ReflectionMethod中文文档ReflectionFunction中文文档

getMessage();
        return;
    }
    $start = $func->getStartLine() - 1;
    $end =  $func->getEndLine() - 1;
    $filename = $func->getFileName();
        echo "function $funcname defined by $filename($start - $end)\n";
    }
    function_dump('a');
    function_dump(array('b', 'f'));
    $b = new b();
    function_dump(array($b, 'f'));
?>

用phpstorm,打开整个工程,然后Ctrl+鼠标点击函数名就可跳转到定义了。

用IDE的话, 直接ctrl+鼠标单击.
用普通编辑器, 就整个项目下查找function 函数名.
用反射类 echo (new ReflectionFunction('函数名'))->getFileName()

以上就是php 如何查看某个函数定义在 那个php文件中的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn