简体   繁体   English

是否可以找出包含的PHP文件中的哪些功能?

[英]Is it possible to figure out which functions are from an included PHP file?

I have a large file that I am looking at that has about 30 files included. 我正在查看一个大文件,其中包含约30个文件。 I am re-factoring this file and am not entirely sure which of the function calls throughout the file are from (if any) which include file. 我正在重构此文件,并且不能完全确定整个文件中的哪个函数调用来自(如果有的话)哪个包含文件。 These files have tons of functions in them. 这些文件中包含大量功能。

Is there anyway to tell whether any function from an included file is used in the large file? 无论如何,大文件中是否使用了包含文件中的任何功能? It is hard to tell because there are many nested if-statements and rather than worrying about figuring out each one it would be easier to literally look for all of the function names in an included php file and see if any are referenced in my large file. 很难说,因为有许多嵌套的if语句,而不是担心弄清楚每个语句,从字面意义上查找包含的php文件中的所有函数名称并查看是否在我的大文件中被引用会更容易。 Does something like this exist? 是否存在这样的东西?

I think you're looking for debug_print_backtrace() 我认为您正在寻找debug_print_backtrace()

From the manual: 从手册中:

debug_print_backtrace() prints a PHP backtrace. debug_print_backtrace()打印PHP回溯。 It prints the function calls, included/required files and eval()ed stuff 它打印函数调用,包含/必需的文件和eval()处理的东西

This might actually not be a solution, there's an interesting answer to a similar question here: that might also be of help. 这实际上可能不是解决方案,这里有一个类似问题的有趣答案这可能也有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM