function.get-included-files.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 144 行
HTML
144 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns an array with the names of included or required files</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.get-include-path.html">get_include_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.get-loaded-extensions.html">get_loaded_extensions</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.get-included-files" class="refentry"> <div class="refnamediv"> <h1 class="refname">get_included_files</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">get_included_files</span> — <span class="dc-title">Returns an array with the names of included or required files</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><b><b>get_included_files</b></b></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> Gets the names of all files that have been included using <b>include()</b>, <b>include_once()</b>, <b>require()</b> or <b>require_once()</b>. </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array of the names of all files. </p> <p class="para"> The script originally called is considered an "included file," so it will be listed together with the files referenced by <b>include()</b> and family. </p> <p class="para"> Files that are included or required multiple times only show up once in the returned array. </p> </div> <div class="refsect1 changelog"> <h3 class="title">ChangeLog</h3> <p class="para"> <table class="informaltable"> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Version</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4.0.1</td> <td colspan="1" rowspan="1" align="left"> In PHP 4.0.1 and previous versions this function assumed that the required files ended in the extension <i>.php</i>; other extensions would not be returned. The array returned by <b>get_included_files()</b> was an associative array and only listed files included by <b>include()</b> and <b>include_once()</b>. </td> </tr> </tbody> </colgroup> </table> </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>get_included_files()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// This file is abc.php<br /><br /></span><span style="color: #007700">include </span><span style="color: #DD0000">'test1.php'</span><span style="color: #007700">;<br />include_once </span><span style="color: #DD0000">'test2.php'</span><span style="color: #007700">;<br />require </span><span style="color: #DD0000">'test3.php'</span><span style="color: #007700">;<br />require_once </span><span style="color: #DD0000">'test4.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$included_files </span><span style="color: #007700">= </span><span style="color: #0000BB">get_included_files</span><span style="color: #007700">();<br /><br />foreach (</span><span style="color: #0000BB">$included_files </span><span style="color: #007700">as </span><span style="color: #0000BB">$filename</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"$filename\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents"><pre><div class="cdata"><pre>abc.phptest1.phptest2.phptest3.phptest4.php</pre></div> </pre></div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: Files included using the <i>auto_prepend_file</i> configuration directive are not included in the returned array. <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><b>include()</b></li> <li class="member"><b>include_once()</b></li> <li class="member"><b>require()</b></li> <li class="member"><b>require_once()</b></li> <li class="member"><a href="function.get-required-files.html" class="function" rel="rdfs-seeAlso">get_required_files()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.get-include-path.html">get_include_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.get-loaded-extensions.html">get_loaded_extensions</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?