Google

NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7">

get_included_files

(PHP 4 )

get_included_files --  includeまたはrequireで読み込まれたファイルの名前を配列として返す

説明

array get_included_files ( void)

この関数は、include(), include_once(), require(), require_once()によりスクリプトにロードされた 全てのファイルの名前を配列として返します。

複数回読み込まれたファイルも返される配列には一度しかあらわれませ ん。

注意 設定ディレクティブauto_prepend_fileにより読み 込まれたファイルは、返される配列には含まれません。

例 1get_included_files()の例

<?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";
}

?>
は以下の出力を生成します。

test1.php
test2.php
test3.php
test4.php

注意 PHP 4.0.1pl2および以前のバージョンにおいて、 get_included_files()は、読み込まれるファイル が拡張子.phpで終ることを仮定しており、他の拡 張子のファイルは返されませんでした。 get_included_files()により返される配列は、連 想配列であり、include()および include_once()で読み込まれたファイルのみが一 覧に含まれていました。

include(), include_once(), require(), require_once(), get_required_files()も参照下さい。