PHP应用程序流程图(或函数调用图) [英] PHP Application Flow Graph (or function call graph)
问题描述
我发现我已经完成了一个大型的PHP程序,我需要一个程序(或者简单的安装脚本),它可以绘制一个PHP应用程序的流程控制/调用图(即;必须能够处理多个PHP文件) 。
已经看到像Graphviz这样的东西,不知道哪一个适用于PHP?
有什么建议吗?
干杯!
我从来没有使用任何可以静态执行的工具(即源文件) em>,但是当执行一个脚本/应用程序时,这里有一个调用图的方法。
首先,您需要安装 Xdebug扩展 - 在开发/测试服务器上(不要安装在制作服务器:对于演出来说相当糟糕^^) 然后,您可以使用它的分析功能,以生成与执行页面加载相对应的
.cachegrindout
文件。
之后,您可以使用 .cachegrindout 文件kcachegrind.sourceforge.net/html/ Home.htmlrel =nofollow noreferrer> KCacheGrind (Linux上 - 我不认为有Windows版本); KCacheGrind可以从 .cachegrindout
文件生成调用图。
以下是callgraph的一个示例:
KCacheGrind: Callgraph导出为图片http://extern.pascal-martin.fr/so/kcachegrind/kcachegrind-2-small.png
(这里是从加载一个博客软件Dotclear的页面获得的 .cachegrindout
文件生成的)
Happens that I've ended up working on a big PHP program and I need a program (or easy to install script) which draws a flow control/call graph of a PHP application (ie; must work over multiple PHP files). Already saw stuff like Graphviz, not sure which one works for PHP?
Any suggestions?
Cheers!
I have never used any tool that can do that statically (i.e. from source files), but here's a way to get a callgraph when executing a script/application.
First, you need to install the Xdebug extension -- on a development/testing server (don't install it on a production server : it's quite bad for performances ^^ )
Then, you can use its profiling features to generate a .cachegrindout
file corresponding to the execution of a page-load.
After that, you can load that .cachegrindout
file with KCacheGrind (On linux -- I don't think there's a windows version) ; KCacheGrind can generate call-graphs from .cachegrindout
files.
And here's an example of callgraph you can get :
(Here's, it's been generated from a .cachegrindout
file obtained while loading a page of Dotclear, a blogging software)
这篇关于PHP应用程序流程图(或函数调用图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!