Home >Backend Development >PHP Tutorial >How to check which php file a function is defined in?
How to check which php file the function appearing in a certain php script is defined in? Use ReflectionFunction. ReflectionMethod Chinese Documentation ReflectionFunction Chinese Documentation
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')); ?>
Use phpstorm to open the entire project, then Ctrl+click the function name to jump to the definition.
If you use an IDE, just ctrl+click with the mouse.
Use a normal editor and search thefunction function name in the entire project
.Use the reflection class
echo (new ReflectionFunction('function name'))->getFileName( )The above is how to check the content of a function defined in that PHP file in PHP. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!