2
假設有一個複雜的PHP腳本,其中包含很多其他PHP文件的動態內容。是否可以列出所有文件,這些文件已包含在某個PHP腳本執行的某個位置?是否可以列出已包含在最終頁面中的PHP文件?
假設有一個複雜的PHP腳本,其中包含很多其他PHP文件的動態內容。是否可以列出所有文件,這些文件已包含在某個PHP腳本執行的某個位置?是否可以列出已包含在最終頁面中的PHP文件?
當然,存在爲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";
}
?>
結果將是這樣的:
abc.php
test1.php
test2.php
test3.php
test4.php