나는 많은 PHP 파일로 구성된 대규모의 복잡한 PHP 프로젝트를 운영하고 있습니다.PHP : 모두 목록을 포함
포함 된 모든 파일의 목록을 반환하는 코드에서 호출 할 수있는 함수가 있습니까?
나는 많은 PHP 파일로 구성된 대규모의 복잡한 PHP 프로젝트를 운영하고 있습니다.PHP : 모두 목록을 포함
포함 된 모든 파일의 목록을 반환하는 코드에서 호출 할 수있는 함수가 있습니까?
get_included_files
또는 get_required_files
(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 (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
예 : get_included_files()
은
register_shutdown_function(
function() {
your_logger(get_included_files());
}
);
는
get_included_files를 호출 할 것이다 스크립트 실행의 끝, 그래서 포함 된 파일의 전체 목록을 얻을거야
답변 일 수 있지만 답변에 설명서 및/또는 설명을 포함하는 것이 좋습니다. – Pietu1998
우수, 어쨌든 나는 문서에서 그것을 찾을 수 없습니다. – Liam
foreach 루프를 사용하는 대신'var_dump (get_included_files())'를 사용할 수 있습니다. 이 함수는 배열을 반환합니다. –