get_included_files

(PHP 4, PHP 5, PHP 7, PHP 8)

get_included_files — 포함되거나 필요한 파일의 이름이 있는 배열을 반환합니다.


설명

get_included_files(): array

include, include_once, require 또는 require_once를 사용하여 포함된 모든 파일의 이름을 가져옵니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

모든 파일의 이름 배열을 반환합니다.

원래 호출된 스크립트는 "포함된 파일"로 간주되므로 include 및 패밀리에서 참조하는 파일과 함께 나열됩니다.

여러 번 포함되거나 필요한 파일은 반환된 배열에 한 번만 표시됩니다.


Examples

예제 #1 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";
}

?>
                  
                

위의 예는 다음을 출력합니다.

/path/to/abc.php
/path/to/test1.php
/path/to/test2.php
/path/to/test3.php
/path/to/test4.php
                

기타