mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
documented issue in bug #9641
completely revamped get_included_files and get_required_files git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@50262 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
5af5696178
commit
e50a121d8e
1 changed files with 55 additions and 57 deletions
|
@ -1599,8 +1599,7 @@ print_r (get_extension_funcs ("gd"));
|
|||
<refnamediv>
|
||||
<refname>get_required_files</refname>
|
||||
<refpurpose>
|
||||
Returns an array with the names of the files require_once()'d or
|
||||
included_once()'d in a script
|
||||
Returns an array with the names of included or required files
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -1608,32 +1607,28 @@ print_r (get_extension_funcs ("gd"));
|
|||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>array <function>get_required_files</function></funcdef>
|
||||
<void/>
|
||||
<paramdef>void</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of all
|
||||
the files that have been loaded into a script using
|
||||
<function>require_once</function> or <function>include_once</function>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 4.0.1pl2 this function assumed that the
|
||||
<varname>required_once</varname> files end in the extension
|
||||
".php", other extensions do not work. Also, in that
|
||||
version the array returned was an associative array, and this
|
||||
function was not an alias for <function>get_included_files</function>
|
||||
</para>
|
||||
<para>
|
||||
As of PHP 4.0.4, this function is an alias for
|
||||
<function>get_included_files</function>
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also: <function>require_once</function>,
|
||||
<function>include_once</function>,
|
||||
As of PHP 4.0.4, this function is an alias for
|
||||
<function>get_included_files</function>
|
||||
</para>
|
||||
<para>
|
||||
In PHP 4.0.1pl2 and previous versions
|
||||
<function>get_required_files</function> assumed that the required
|
||||
files ended in the extension <literal>.php</literal>, other
|
||||
extensions would not be returned. The array returned by
|
||||
<function>get_required_files</function> was an associative array
|
||||
and only listed files included by <function>require</function> and
|
||||
<function>require_once</function>.
|
||||
</para>
|
||||
<para>
|
||||
See also: <function>require</function>,
|
||||
<function>require_once</function>, <function>include</function>,
|
||||
<function>include_once</function> and
|
||||
<function>get_included_files</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
@ -1641,8 +1636,7 @@ print_r (get_extension_funcs ("gd"));
|
|||
<refnamediv>
|
||||
<refname>get_included_files</refname>
|
||||
<refpurpose>
|
||||
Returns an array with the names of the files include_once()'d in
|
||||
a script
|
||||
Returns an array with the names of included or required files
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -1650,61 +1644,65 @@ print_r (get_extension_funcs ("gd"));
|
|||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>array <function>get_included_files</function></funcdef>
|
||||
<void/>
|
||||
<paramdef>void</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns an array of the names of all
|
||||
the files that have been loaded into a script using
|
||||
<function>require_once</function> or
|
||||
<function>include_once</function>.
|
||||
Returns an array of the names of all files that have been
|
||||
included using <function>include</function>,
|
||||
<function>include_once</function>, <function>require</function>
|
||||
or <function>require_once</function>.
|
||||
</para>
|
||||
<para>
|
||||
Files that are included or required multiple times only show up
|
||||
once in the returned array.
|
||||
</para>
|
||||
<para>
|
||||
The example below
|
||||
<example>
|
||||
<title>Printing the required and included files</title>
|
||||
<programlisting>
|
||||
<title><function>get_included_files</function> Example</title>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
|
||||
require_once ("local.php");
|
||||
require_once ("../inc/global.php");
|
||||
include("test1.php");
|
||||
include_once("test2.php");
|
||||
require("test3.php");
|
||||
require_once("test4.php");
|
||||
|
||||
for ($i=1; $i<5; $i++)
|
||||
include "util".$i.".php";
|
||||
$included_files = get_included_files();
|
||||
|
||||
echo "Required_once/Included_once files\n";
|
||||
print_r (get_required_files());
|
||||
foreach($included_files as $filename) {
|
||||
echo "$filename\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
will generate the following output:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
Required_once/Included_once files
|
||||
Array
|
||||
(
|
||||
[0] => local.php
|
||||
[1] => /full/path/to/inc/global.php
|
||||
[2] => util1.php
|
||||
[3] => util2.php
|
||||
[4] => util3.php
|
||||
[5] => util4.php
|
||||
)
|
||||
test1.php
|
||||
test2.php
|
||||
test3.php
|
||||
test4.php
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 4.0.1pl2 this function assumed that the
|
||||
<varname>include_once</varname> files end in the extension
|
||||
".php", other extensions do not work. Also, in that
|
||||
version the array returned was an associative array, and
|
||||
listed only the included files.
|
||||
In PHP 4.0.1pl2 and previous versions
|
||||
<function>get_included_files</function> assumed that the
|
||||
required files ended in the extension <literal>.php</literal>;
|
||||
other extensions would not be returned. The array returned by
|
||||
<function>get_included_files</function> was an associative array
|
||||
and only listed files included by <function>include</function>
|
||||
and <function>include_once</function>.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also: <function>require_once</function>,
|
||||
<function>include_once</function>,
|
||||
<function>get_required_files</function>
|
||||
See also: <function>include</function>,
|
||||
<function>include_once</function>, <function>require</function>,
|
||||
<function>require_once</function> and
|
||||
<function>get_required_files</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
Loading…
Reference in a new issue