함수 get_included_files
함수 get_included_files는 현재 스크립트에 연결된 모든 파일의 전체 경로 배열을 반환합니다.
이것은 실제로 어떤 파일들이 로드되었는지 확인해야 할 때 디버깅에 유용합니다.
문법
get_included_files();
예시
간단한 스크립트에서 연결된 파일 목록을 확인해 봅시다:
<?php
include 'header.php';
require 'config.php';
$res = get_included_files();
print_r($res);
?>
코드 실행 결과:
[
'/path/to/main.php',
'/path/to/header.php',
'/path/to/config.php'
]
예시
연결된 파일 수를 확인해 봅시다:
<?php
include 'functions.php';
include_once 'utils.php';
$res = count(get_included_files());
echo $res;
?>
코드 실행 결과:
3
함께 보기
-
함수
print_r,
변수 정보를 출력하는 함수 -
함수
debug_backtrace,
호출 스택을 반환하는 함수