php-doc-en/functions/dir.sgml
James Gingerich 82c6591284 Many minor cleanups.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9864 c90b9560-bf6c-de11-be94-00142212c4b1
1999-06-20 03:04:56 +00:00

165 lines
4.5 KiB
Text

<reference id="ref.dir">
<title>Directory functions</title>
<titleabbrev>Directories</titleabbrev>
<refentry id="function.chdir">
<refnamediv>
<refname>chdir</refname>
<refpurpose>change directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>chdir</function></funcdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
Changes PHP's current directory to
<parameter>directory</parameter>. Returns FALSE if unable to
change directory, TRUE otherwise.
</refsect1>
</refentry>
<refentry id="class.dir">
<refnamediv>
<refname>dir</refname>
<refpurpose>directory class</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>new <function>dir</function></funcdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
A pseudo-object oriented mechanism for reading a directory. The
given <parameter>directory</parameter> is opened. Two properties
are available once 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.
<example><title>Dir() Example</title>
<programlisting role=php>
$d = dir("/etc");
echo "Handle: ".$d->handle."&lt;br>\n";
echo "Path: ".$d->path."&lt;br>\n";
while($entry=$d->read()) {
echo $entry."&lt;br>\n";
}
$d->close();
</programlisting></example>
</refsect1>
</refentry>
<refentry id="function.closedir">
<refnamediv>
<refname>closedir</refname>
<refpurpose>close directory handle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>void <function>closedir</function></funcdef>
<paramdef>int <parameter>dir_handle</parameter></paramdef>
</funcsynopsis>
<para>
Closes the directory stream indicated by
<parameter>dir_handle</parameter>. The stream must have previously
been opened by <function>opendir</function>.
</refsect1>
</refentry>
<refentry id="function.opendir">
<refnamediv>
<refname>opendir</refname>
<refpurpose>open directory handle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>opendir</function></funcdef>
<paramdef>string <parameter>path</parameter></paramdef>
</funcsynopsis>
<para> Returns a directory handle to be used in subsequent <function>closedir</function>, <function>readdir</function>, and <function>rewinddir</function> calls.
</para>
</refsect1>
</refentry>
<refentry id="function.readdir">
<refnamediv>
<refname>readdir</refname>
<refpurpose>read entry from directory handle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>readdir</function></funcdef>
<paramdef>int <parameter>dir_handle</parameter></paramdef>
</funcsynopsis>
<para>
Returns the filename of the next file from the directory. The
filenames are not returned in any particular order.
<example><title>List all files in the current directory</title>
<programlisting>
&lt;?php
$handle=opendir('.');
echo "Directory handle: $handle\n";
echo "Files:\n";
while ($file = readdir($handle)) {
echo "$file\n";
}
closedir($handle);
?>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.rewinddir">
<refnamediv>
<refname>rewinddir</refname>
<refpurpose>rewind directory handle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>void <function>rewinddir</function></funcdef>
<paramdef>int <parameter>dir_handle</parameter></paramdef>
</funcsynopsis>
<para>
Resets the directory stream indicated by
<parameter>dir_handle</parameter> to the beginning of the directory.
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->