开发者

is there a way to see which files include/require other files?

开发者 https://www.devze.com 2023-02-15 08:50 出处:网络
I\'m currently working with Active Collab, which is built follow开发者_JS百科ing the MVC programming architecture, meaning a lot of files including/requiring a lot of other files. The system is pretty

I'm currently working with Active Collab, which is built follow开发者_JS百科ing the MVC programming architecture, meaning a lot of files including/requiring a lot of other files. The system is pretty big and i need to do some reverse engineering as i am looking for some specific functions.

Is there a way to see in logs or any other way to know which files include others files and in what order?

UPDATE

I did use get_included_files(), which answers my question, but i ended up with an array of over 100 filenames.


One way to find out what files are included is to use 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";
}

would give you:

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


BTW, if you have an IDE of some sort (I'm thinking about PHPStorm) - it will index all of your files, and you can simply ctrl-click a function call anywhere, and it will go to the file/location where the function is being defined...

I don't use PHPStorm anymore, but I wish Notepad++ added that feature!

0

精彩评论

暂无评论...
验证码 换一张
取 消