<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >get_included_files</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="PHP Options&Information" HREF="ref.info.html"><LINK REL="PREVIOUS" TITLE="get_include_path" HREF="function.get-include-path.html"><LINK REL="NEXT" TITLE="get_loaded_extensions" HREF="function.get-loaded-extensions.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.get-include-path.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.get-loaded-extensions.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.get-included-files" ></A >get_included_files</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN180996" ></A ><P > (PHP 4, PHP 5)</P >get_included_files -- Returns an array with the names of included or required files</DIV ><DIV CLASS="refsect1" ><A NAME="AEN180999" ></A ><H2 >说明</H2 >array <B CLASS="methodname" >get_included_files</B > ( void )<BR ></BR ><P > Gets the names of all files that have been included using <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A >, <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A >, <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A > or <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A >. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN181010" ></A ><H2 >返回值</H2 ><P > Returns an array of the names of all files. </P ><P > The script originally called is considered an "included file," so it will be listed together with the files referenced by <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A > and family. </P ><P > Files that are included or required multiple times only show up once in the returned array. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN181016" ></A ><H2 >更新日志</H2 ><P > <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN181019" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >版本</TH ><TH >说明</TH ></TR ></THEAD ><TBODY ><TR ><TD >4.0.1</TD ><TD > In PHP 4.0.1 and previous versions this function assumed that the required files ended in the extension <TT CLASS="literal" >.php</TT >; other extensions would not be returned. The array returned by <B CLASS="function" >get_included_files()</B > was an associative array and only listed files included by <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A > and <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A >. </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN181033" ></A ><H2 >范例</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN181036" ></A ><P ><B >例 1. <B CLASS="function" >get_included_files()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// This file is abc.php<br /><br /></font><font color="#007700">include </font><font color="#DD0000">'test1.php'</font><font color="#007700">;<br />include_once </font><font color="#DD0000">'test2.php'</font><font color="#007700">;<br />require </font><font color="#DD0000">'test3.php'</font><font color="#007700">;<br />require_once </font><font color="#DD0000">'test4.php'</font><font color="#007700">;<br /><br /></font><font color="#0000BB">$included_files </font><font color="#007700">= </font><font color="#0000BB">get_included_files</font><font color="#007700">();<br /><br />foreach (</font><font color="#0000BB">$included_files </font><font color="#007700">as </font><font color="#0000BB">$filename</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">"$filename</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br />}<br /><br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >abc.php test1.php test2.php test3.php test4.php</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN181042" ></A ><H2 >注释</H2 ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > Files included using the <TT CLASS="literal" >auto_prepend_file</TT > configuration directive are not included in the returned array. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN181047" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.include.html" ><B CLASS="function" >include()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.require.html" ><B CLASS="function" >require()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.get-required-files.html" ><B CLASS="function" >get_required_files()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.get-include-path.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.get-loaded-extensions.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >get_include_path</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.info.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >get_loaded_extensions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >