PHP:列出所有包括 [英] PHP: List all includes
本文介绍了PHP:列出所有包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个由许多PHP文件组成的大型复杂PHP项目.
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?
推荐答案
get_included_files
或get_required_files
(get_included_files
的别名)
http://us.php.net/manual/zh/function.get-included-files.php
http://us.php.net/manual/en/function .get-required-files.php (get_included_files
的别名)
http://us.php.net/manual/en/function.get-included-files.php
http://us.php.net/manual/en/function.get-required-files.php (Alias of 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
这篇关于PHP:列出所有包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文