有没有办法看到哪些文件包含/需要其他文件?

时间:2011-03-08 16:46:49

标签: php model-view-controller

我目前正在使用Active Collab,它是按照MVC编程架构构建的,这意味着很多文件包括/需要很多其他文件。系统非常大,我需要做一些逆向工程,因为我正在寻找一些特定的功能。

有没有办法以日志或其他方式查看哪些文件包含其他文件以及按什么顺序排列?

更新

我确实使用了get_included_files(),这回答了我的问题,但我最终得到了一个包含100多个文件名的数组。

2 个答案:

答案 0 :(得分:2)

找出所包含文件的一种方法是使用get_included_files()/get_required_files()

E.G:

// This file is abc.php
include 'test1.php';
include_once 'test2.php';
require 'test3.php';
require_once 'test4.php';

$included_files = get_included_files();

foreach ($included_files as $filename) {
    echo "$filename\n";
}

会给你:

abc.php
test1.php
test2.php
test3.php
test4.php

答案 1 :(得分:0)

顺便说一句,如果你有某种类型的IDE(我正在考虑PHPStorm) - 它会为你的所有文件编制索引,你只需在任意位置按住Ctrl键单击一个函数调用,它就会转到文件/正在定义函数的位置......

我不再使用PHPStorm,但我希望Notepad ++添加该功能!

相关问题