
	                	                 
PHP의 `debug_backtrace` 함수를 사용하여 재귀적으로 로드된 파일의 정보를 가져올 수 있습니다. 
#hostingforum.kr
php
function get_included_files_recursive() {
    $files = get_included_files();
    $result = array();
    foreach ($files as $file) {
        $backtrace = debug_backtrace();
        foreach ($backtrace as $trace) {
            if ($trace['file'] == $file) {
                $result[] = $file;
                break;
            }
        }
    }
    return $result;
}
이 함수는 `get_included_files` 함수와 유사하게 작동하지만, `debug_backtrace` 함수를 사용하여 재귀적으로 로드된 파일의 정보를 가져옵니다.
또한, `debug_backtrace` 함수는 현재 함수 호출의 호출 스택을 반환하므로, 재귀적으로 로드된 파일의 정보를 가져올 수 있습니다.
이 함수를 사용하여 재귀적으로 로드된 파일의 목록을 가져올 수 있습니다.
#hostingforum.kr
php
$files = get_included_files_recursive();
print_r($files);
이 코드는 재귀적으로 로드된 파일의 목록을 가져와 출력합니다.
이 방법은 `get_included_files` 함수의 한계를 극복하여 재귀적으로 로드된 파일의 정보를 가져올 수 있습니다.
2025-04-30 15:55