I have a large complex PHP project made up of many PHP files.
Is there some function I can call in my code that will return a list of all included files?
PHP Include Files. The include (or require ) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement. Including files is very useful when you want to include the same PHP, HTML, or text on multiple pages of a website.
Calling get_included_files() returns an array containing all the included files whether they were included with the include() include_once() require() or require_once() functions.
register_shutdown_function(
function() {
your_logger(get_included_files());
}
);
get_included_files will be called at the end of script execution, so u`ll get full list of included files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With