在使用 php 开发项目,
使用自己开发的框架或第三方框架,
想要看看脚本中加载了哪些脚本文件,
可以使用 get_included_files() 函数
get_included_files() 返回一个数组,
包括了,
include, include_once
require, require_once
的脚本文件。
官方的解释是
Gets the names of all files that have been included using include, include_once, require or require_once.
举个例子
<?PHP
// file name test.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<br />";
}
输出结果是
D:\www\test\test.php
D:\www\test\test1.php
D:\www\test\test2.php
D:\www\test\test3.php
D:\www\test\test4.php
如果 test1.php 脚本中,
又通过 require 引入其它脚本,
也会显示出来。
猛击这里,
观看子恒老师《php订单系统开发设计》