2017-04-03 59 views
-5

我想获取包含在给定路径的文件中的文件的名称/路径。但是get_included_files()函数仅适用于写入它的文件。get_included_files()为定义的路径

<? 
    include_once('/folder1/folder2/xyz.php'); 
    $path = '/abcd.php'; 
    $includeFiles = get_included_files(); 
?> 

我已经尝试了上面的代码,我只在这个文件中只包含文件。 我想获取abcd.php中包含文件的名称,即定义的路径。

请帮助!

+0

有一个关于'get_included_files()有用[文件](http://php.net/manual/en/function.get-included-files.php);',你看过吗? – Jer

回答

0

这样的事情呢?

array_filter(get_included_files(), function($item) { 
    return strpos($item, '/path/to/files/') === 0;                
});