mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
WS, preparation for the new doc style
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@184181 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f29b450b2b
commit
fb99bcd65c
9 changed files with 384 additions and 384 deletions
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.chdir">
|
||||
<refnamediv>
|
||||
<refname>chdir</refname>
|
||||
<refpurpose>Change directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>chdir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Changes PHP's current directory to
|
||||
<parameter>directory</parameter>. &return.success;
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>chdir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.chdir">
|
||||
<refnamediv>
|
||||
<refname>chdir</refname>
|
||||
<refpurpose>Change directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>chdir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Changes PHP's current directory to
|
||||
<parameter>directory</parameter>. &return.success;
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>chdir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
@ -33,22 +33,22 @@ echo getcwd() . "\n";
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/home/vincent
|
||||
/home/vincent/public_html
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.sm.uidcheck.dir;
|
||||
<para>
|
||||
See also <function>getcwd</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
¬e.sm.uidcheck.dir;
|
||||
<para>
|
||||
See also <function>getcwd</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.11 -->
|
||||
<refentry id="function.chroot">
|
||||
<refnamediv>
|
||||
<refname>chroot</refname>
|
||||
<refpurpose>Change the root directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>chroot</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Changes the root directory of the current process to
|
||||
<parameter>directory</parameter>. &return.success;
|
||||
</para>
|
||||
<para>
|
||||
This function is only available if your system supports it and
|
||||
you're using the CLI, CGI or Embed SAPI.
|
||||
</para>
|
||||
<note><simpara><function>chroot</function> requires root privileges.</simpara></note>
|
||||
¬e.no-windows;
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<refentry id="function.chroot">
|
||||
<refnamediv>
|
||||
<refname>chroot</refname>
|
||||
<refpurpose>Change the root directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>chroot</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Changes the root directory of the current process to
|
||||
<parameter>directory</parameter>. &return.success;
|
||||
</para>
|
||||
<para>
|
||||
This function is only available if your system supports it and
|
||||
you're using the CLI, CGI or Embed SAPI.
|
||||
</para>
|
||||
<note><simpara><function>chroot</function> requires root privileges.</simpara></note>
|
||||
¬e.no-windows;
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="class.dir">
|
||||
<refnamediv>
|
||||
<refname>dir</refname>
|
||||
<refpurpose>Directory class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<classsynopsis>
|
||||
<ooclass><classname>dir</classname></ooclass>
|
||||
<constructorsynopsis>
|
||||
<methodname>dir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</constructorsynopsis>
|
||||
<fieldsynopsis>
|
||||
<type>string</type><varname>path</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<type>resource</type><varname>handle</varname>
|
||||
</fieldsynopsis>
|
||||
<methodsynopsis><type>string</type><methodname>read</methodname><void/></methodsynopsis>
|
||||
<methodsynopsis><type>void</type><methodname>rewind</methodname><void/></methodsynopsis>
|
||||
<methodsynopsis><type>void</type><methodname>close</methodname><void/></methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
A pseudo-object oriented mechanism for reading a directory. The
|
||||
given <parameter>directory</parameter> is opened. Two properties
|
||||
are available once the directory has been opened. The handle
|
||||
property can be used with other directory functions such as
|
||||
<function>readdir</function>, <function>rewinddir</function> and
|
||||
<function>closedir</function>. The path property is set to path
|
||||
the directory that was opened. Three methods are available:
|
||||
read, rewind and close.
|
||||
</para>
|
||||
<para>
|
||||
Please note the fashion in which <function>dir</function>'s
|
||||
return value is checked in the example below. We are explicitly
|
||||
testing whether the return value is identical to (equal to and of
|
||||
the same type as--see <link linkend="language.operators.comparison">
|
||||
Comparison Operators</link> for more information) &false; since
|
||||
otherwise, any directory entry whose name evaluates to &false; will
|
||||
stop the loop.
|
||||
<example>
|
||||
<title><function>dir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="class.dir">
|
||||
<refnamediv>
|
||||
<refname>dir</refname>
|
||||
<refpurpose>Directory class</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<classsynopsis>
|
||||
<ooclass><classname>dir</classname></ooclass>
|
||||
<constructorsynopsis>
|
||||
<methodname>dir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
</constructorsynopsis>
|
||||
<fieldsynopsis>
|
||||
<type>string</type><varname>path</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<type>resource</type><varname>handle</varname>
|
||||
</fieldsynopsis>
|
||||
<methodsynopsis><type>string</type><methodname>read</methodname><void/></methodsynopsis>
|
||||
<methodsynopsis><type>void</type><methodname>rewind</methodname><void/></methodsynopsis>
|
||||
<methodsynopsis><type>void</type><methodname>close</methodname><void/></methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
A pseudo-object oriented mechanism for reading a directory. The
|
||||
given <parameter>directory</parameter> is opened. Two properties
|
||||
are available once the directory has been opened. The handle
|
||||
property can be used with other directory functions such as
|
||||
<function>readdir</function>, <function>rewinddir</function> and
|
||||
<function>closedir</function>. The path property is set to path
|
||||
the directory that was opened. Three methods are available:
|
||||
read, rewind and close.
|
||||
</para>
|
||||
<para>
|
||||
Please note the fashion in which <function>dir</function>'s
|
||||
return value is checked in the example below. We are explicitly
|
||||
testing whether the return value is identical to (equal to and of
|
||||
the same type as--see <link linkend="language.operators.comparison">
|
||||
Comparison Operators</link> for more information) &false; since
|
||||
otherwise, any directory entry whose name evaluates to &false; will
|
||||
stop the loop.
|
||||
<example>
|
||||
<title><function>dir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$d = dir("/etc/php5");
|
||||
|
@ -56,9 +56,9 @@ while (false !== ($entry = $d->read())) {
|
|||
$d->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Handle: Resource id #2
|
||||
Path: /etc/php5
|
||||
|
@ -68,26 +68,26 @@ apache
|
|||
cgi
|
||||
cli
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The order in which directory entries are returned by the read method is
|
||||
system-dependent.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
This defines the internal class
|
||||
<classname>Directory</classname>, meaning that you will not be
|
||||
able to define your own classes with that name. For a full list
|
||||
of predefined classes in PHP, please see <link
|
||||
linkend="reserved.classes">Predefined Classes</link>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The order in which directory entries are returned by the read method is
|
||||
system-dependent.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
This defines the internal class
|
||||
<classname>Directory</classname>, meaning that you will not be
|
||||
able to define your own classes with that name. For a full list
|
||||
of predefined classes in PHP, please see <link
|
||||
linkend="reserved.classes">Predefined Classes</link>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.closedir">
|
||||
<refnamediv>
|
||||
<refname>closedir</refname>
|
||||
<refpurpose>Close directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>closedir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Closes the directory stream indicated by
|
||||
<parameter>dir_handle</parameter>. The stream must have previously
|
||||
been opened by <function>opendir</function>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>closedir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.closedir">
|
||||
<refnamediv>
|
||||
<refname>closedir</refname>
|
||||
<refpurpose>Close directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>closedir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Closes the directory stream indicated by
|
||||
<parameter>dir_handle</parameter>. The stream must have previously
|
||||
been opened by <function>opendir</function>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>closedir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dir = "/etc/php5/";
|
||||
|
@ -34,11 +34,11 @@ if (is_dir($dir)) {
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.7 -->
|
||||
<refentry id="function.getcwd">
|
||||
<refnamediv>
|
||||
<refname>getcwd</refname>
|
||||
<refpurpose>Gets the current working directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>getcwd</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the current working directory, or &false; on failure.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
On some Unix variants, <function>getcwd</function> will return
|
||||
&false; if any one of the parent directories does not have the
|
||||
readable or search mode set, even if the current directory
|
||||
does. See <function>chmod</function> for more information on
|
||||
modes and permissions.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>getcwd</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.getcwd">
|
||||
<refnamediv>
|
||||
<refname>getcwd</refname>
|
||||
<refpurpose>Gets the current working directory</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>getcwd</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the current working directory, or &false; on failure.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
On some Unix variants, <function>getcwd</function> will return
|
||||
&false; if any one of the parent directories does not have the
|
||||
readable or search mode set, even if the current directory
|
||||
does. See <function>chmod</function> for more information on
|
||||
modes and permissions.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>getcwd</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
@ -41,22 +41,22 @@ echo getcwd() . "\n";
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/home/didou
|
||||
/home/didou/cvs
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>chdir</function> and
|
||||
<function>chmod</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>chdir</function> and
|
||||
<function>chmod</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.opendir">
|
||||
<refnamediv>
|
||||
<refname>opendir</refname>
|
||||
<refpurpose>Open directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>opendir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a directory handle to be used in subsequent
|
||||
<function>closedir</function>, <function>readdir</function>, and
|
||||
<function>rewinddir</function> calls.
|
||||
</para>
|
||||
<para>
|
||||
If <parameter>path</parameter> is not a valid directory or the
|
||||
directory can not be opened due to permission restrictions or
|
||||
filesystem errors, <function>opendir</function> returns &false; and
|
||||
generates a PHP error of level <link linkend="errorfunc.constants">
|
||||
E_WARNING</link>. You can suppress the error output of
|
||||
<function>opendir</function> by prepending
|
||||
'<link linkend="language.operators.errorcontrol">@</link>' to the
|
||||
front of the function name.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>opendir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.opendir">
|
||||
<refnamediv>
|
||||
<refname>opendir</refname>
|
||||
<refpurpose>Open directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>opendir</methodname>
|
||||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a directory handle to be used in subsequent
|
||||
<function>closedir</function>, <function>readdir</function>, and
|
||||
<function>rewinddir</function> calls.
|
||||
</para>
|
||||
<para>
|
||||
If <parameter>path</parameter> is not a valid directory or the
|
||||
directory can not be opened due to permission restrictions or
|
||||
filesystem errors, <function>opendir</function> returns &false; and
|
||||
generates a PHP error of level <link linkend="errorfunc.constants">
|
||||
E_WARNING</link>. You can suppress the error output of
|
||||
<function>opendir</function> by prepending
|
||||
'<link linkend="language.operators.errorcontrol">@</link>' to the
|
||||
front of the function name.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>opendir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dir = "/etc/php5/";
|
||||
|
@ -46,9 +46,9 @@ if (is_dir($dir)) {
|
|||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
filename: . : filetype: dir
|
||||
filename: .. : filetype: dir
|
||||
|
@ -56,23 +56,23 @@ filename: apache : filetype: dir
|
|||
filename: cgi : filetype: dir
|
||||
filename: cli : filetype: dir
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
As of PHP 4.3.0 <parameter>path</parameter> can also
|
||||
be any URL which supports directory listing, however only the <literal>file://</literal>
|
||||
URL wrapper supports this in PHP 4.3. As of
|
||||
PHP 5.0.0, support for the <literal>ftp://</literal>
|
||||
URL wrapper is included as well.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>is_dir</function>,
|
||||
<function>readdir</function>, and
|
||||
<link linkend="class.dir">Dir</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
As of PHP 4.3.0 <parameter>path</parameter> can also
|
||||
be any URL which supports directory listing, however only the <literal>file://</literal>
|
||||
URL wrapper supports this in PHP 4.3. As of
|
||||
PHP 5.0.0, support for the <literal>ftp://</literal>
|
||||
URL wrapper is included as well.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>is_dir</function>,
|
||||
<function>readdir</function>, and
|
||||
<link linkend="class.dir">Dir</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.readdir">
|
||||
<refnamediv>
|
||||
<refname>readdir</refname>
|
||||
<refpurpose>Read entry from directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>readdir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the filename of the next file from the directory. The
|
||||
filenames are returned in the order in which they are stored by
|
||||
the filesystem.
|
||||
</para>
|
||||
<para>
|
||||
Please note the fashion in which <function>readdir</function>'s
|
||||
return value is checked in the examples below. We are explicitly
|
||||
testing whether the return value is identical to (equal to and of
|
||||
the same type as--see <link
|
||||
linkend="language.operators.comparison">Comparison
|
||||
Operators</link> for more information) &false; since otherwise,
|
||||
any directory entry whose name evaluates to &false; will stop the
|
||||
loop (e.g. a directory named "0").
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>List all files in a directory</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.readdir">
|
||||
<refnamediv>
|
||||
<refname>readdir</refname>
|
||||
<refpurpose>Read entry from directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>readdir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the filename of the next file from the directory. The
|
||||
filenames are returned in the order in which they are stored by
|
||||
the filesystem.
|
||||
</para>
|
||||
<para>
|
||||
Please note the fashion in which <function>readdir</function>'s
|
||||
return value is checked in the examples below. We are explicitly
|
||||
testing whether the return value is identical to (equal to and of
|
||||
the same type as--see <link
|
||||
linkend="language.operators.comparison">Comparison
|
||||
Operators</link> for more information) &false; since otherwise,
|
||||
any directory entry whose name evaluates to &false; will stop the
|
||||
loop (e.g. a directory named "0").
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>List all files in a directory</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Note that !== did not exist until 4.0.0-RC2
|
||||
|
@ -40,54 +40,54 @@ if ($handle = opendir('/path/to/files')) {
|
|||
echo "Files:\n";
|
||||
|
||||
/* This is the correct way to loop over the directory. */
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
echo "$file\n";
|
||||
}
|
||||
|
||||
/* This is the WRONG way to loop over the directory. */
|
||||
while ($file = readdir($handle)) {
|
||||
while ($file = readdir($handle)) {
|
||||
echo "$file\n";
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
closedir($handle);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Note that <function>readdir</function> will return the <literal>.</literal>
|
||||
and
|
||||
<literal>..</literal> entries. If you don't want these, simply strip
|
||||
them out:
|
||||
<example>
|
||||
<title>
|
||||
List all files in the current directory and strip out <literal>.</literal>
|
||||
and <literal>..</literal>
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Note that <function>readdir</function> will return the <literal>.</literal>
|
||||
and
|
||||
<literal>..</literal> entries. If you don't want these, simply strip
|
||||
them out:
|
||||
<example>
|
||||
<title>
|
||||
List all files in the current directory and strip out <literal>.</literal>
|
||||
and <literal>..</literal>
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
<?php
|
||||
if ($handle = opendir('.')) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
echo "$file\n";
|
||||
}
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
echo "$file\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
closedir($handle);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>is_dir</function> and
|
||||
<function>glob</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>is_dir</function> and
|
||||
<function>glob</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.rewinddir">
|
||||
<refnamediv>
|
||||
<refname>rewinddir</refname>
|
||||
<refpurpose>Rewind directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>rewinddir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Resets the directory stream indicated by
|
||||
<parameter>dir_handle</parameter> to the beginning of the
|
||||
directory.
|
||||
</para>
|
||||
<refentry id="function.rewinddir">
|
||||
<refnamediv>
|
||||
<refname>rewinddir</refname>
|
||||
<refpurpose>Rewind directory handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>rewinddir</methodname>
|
||||
<methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Resets the directory stream indicated by
|
||||
<parameter>dir_handle</parameter> to the beginning of the
|
||||
directory.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.scandir">
|
||||
<refnamediv>
|
||||
<refname>scandir</refname>
|
||||
<refpurpose>
|
||||
List files and directories inside the specified path
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>scandir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>sorting_order</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns an <type>array</type> of files and directories from the
|
||||
<parameter>directory</parameter>. If <parameter>directory</parameter>
|
||||
is not a directory, then boolean &false; is returned, and an error of
|
||||
level <constant>E_WARNING</constant> is generated.
|
||||
</para>
|
||||
<para>
|
||||
By default, the sorted order is alphabetical in ascending order. If
|
||||
the optional <parameter>sorting_order</parameter> is used (set to 1),
|
||||
then sort order is alphabetical in descending order.
|
||||
</para>
|
||||
<para>
|
||||
For a description of the <parameter>context</parameter> parameter, refer
|
||||
to <xref linkend="ref.stream"/>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>A simple <function>scandir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.scandir">
|
||||
<refnamediv>
|
||||
<refname>scandir</refname>
|
||||
<refpurpose>
|
||||
List files and directories inside the specified path
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>scandir</methodname>
|
||||
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>sorting_order</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns an <type>array</type> of files and directories from the
|
||||
<parameter>directory</parameter>. If <parameter>directory</parameter>
|
||||
is not a directory, then boolean &false; is returned, and an error of
|
||||
level <constant>E_WARNING</constant> is generated.
|
||||
</para>
|
||||
<para>
|
||||
By default, the sorted order is alphabetical in ascending order. If
|
||||
the optional <parameter>sorting_order</parameter> is used (set to 1),
|
||||
then sort order is alphabetical in descending order.
|
||||
</para>
|
||||
<para>
|
||||
For a description of the <parameter>context</parameter> parameter, refer
|
||||
to <xref linkend="ref.stream"/>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>A simple <function>scandir</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dir = '/tmp';
|
||||
|
@ -44,9 +44,9 @@ print_r($files1);
|
|||
print_r($files2);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -65,13 +65,13 @@ Array
|
|||
[4] => .
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>PHP 4 alternatives to <function>scandir</function></title>
|
||||
<programlisting role="php">
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>PHP 4 alternatives to <function>scandir</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dir = "/tmp";
|
||||
|
@ -90,9 +90,9 @@ print_r($files);
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -111,19 +111,19 @@ Array
|
|||
[4] => .
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
&tip.fopen-wrapper;
|
||||
<para>
|
||||
See also <function>opendir</function>,
|
||||
<function>readdir</function>,
|
||||
<function>glob</function>,
|
||||
<function>is_dir</function>, and
|
||||
<function>sort</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
&tip.fopen-wrapper;
|
||||
<para>
|
||||
See also <function>opendir</function>,
|
||||
<function>readdir</function>,
|
||||
<function>glob</function>,
|
||||
<function>is_dir</function>, and
|
||||
<function>sort</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
Loading…
Reference in a new issue