I have a large complex PHP project consisting of many PHP files.
Is there any function that I can call in my code that will return a list of all included files?
get_included_files or get_required_files (alias get_included_files )
get_included_files
get_required_files
http://us.php.net/manual/en/function.get-included-files.phphttp://us.php.net/manual/en/function.get-required-files.php (Alias get_included_files )
<?php // 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"; } ?> ----- The above example will output: abc.php test1.php test2.php test3.php test4.php
Yes: get_included_files()
get_included_files()
register_shutdown_function( function() { your_logger(get_included_files()); } );
get_included_files will be called at the end of the script, so you will get a complete list of included files