cvs: phpdoc-zh /reference/dir/functions opendir.xml
| From: | Dallas Thunder | Date: | Mon, 24 Feb 2003 05:49:06 +0000 |
| Subject: | cvs: phpdoc-zh /reference/dir/functions opendir.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1100@lists.php.net to get a copy of this message | ||
dallas Mon Feb 24 00:49:06 2003 EDT
Modified files:
/phpdoc-zh/reference/dir/functions opendir.xml
Log:
updated.
Index: phpdoc-zh/reference/dir/functions/opendir.xml
diff -u phpdoc-zh/reference/dir/functions/opendir.xml:1.2
phpdoc-zh/reference/dir/functions/opendir.xml:1.3
--- phpdoc-zh/reference/dir/functions/opendir.xml:1.2 Sun Sep 29 23:08:49 2002
+++ phpdoc-zh/reference/dir/functions/opendir.xml Mon Feb 24 00:49:06 2003
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- $Author: dallas $ -->
-<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready -->
+<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready -->
<refentry id="function.opendir">
<refnamediv>
<refname>opendir</refname>
@@ -21,8 +21,9 @@
<para>
Èç¹û <parameter>path</parameter>
²»ÊÇÒ»¸öºÏ·¨µÄĿ¼»òÕßÒòΪȨÏÞÏÞÖÆ»òÎļþϵͳ´íÎó¶ø²»ÄÜ´ò¿ªÄ¿Â¼£¬<function>opendir</function>
- ·µ»Ø &false; ²¢²úÉúÒ»¸ö PHP ´íÎóÐÅÏ¢¡£¿ÉÒÔÔÚ
<function>opendir</function>
- Ç°Ãæ¼ÓÉÏ¡°@¡±·ûºÅÀ´ÒÖÖÆ´íÎóÐÅÏ¢µÄÊä³ö¡£
+ ·µ»Ø &false; ²¢²úÉúÒ»¸ö <link
linkend="errorfunc.constants">E_WARNING</link>
+ ¼¶±ðµÄ PHP ´íÎóÐÅÏ¢¡£¿ÉÒÔÔÚ <function>opendir</function>
+ Ç°Ãæ¼ÓÉÏ¡°<link
linkend="language.operators.errorcontrol">@</link>¡±·ûºÅÀ´ÒÖÖÆ´íÎóÐÅÏ¢µÄÊä³ö¡£
</para>
<para>
<example>
@@ -30,20 +31,25 @@
<programlisting role="php">
<![CDATA[
<?php
-
-if ($dir = @opendir("/tmp")) {
- while (($file = readdir($dir)) !== false) {
- echo "$file\n";
- }
- closedir($dir);
+$dir = "/tmp/";
+// Open a known directory, and proceed to read its contents
+if (is_dir($dir)) {
+ if ($dh = opendir($dir)) {
+ while (($file = readdir($dh)) !== false) {
+ print "filename: $file : filetype: " . filetype($dir . $file) .
"\n";
+ }
+ closedir($dh);
+ }
}
-
?>
]]>
</programlisting>
</example>
</para>
- <para>²Î¼û <function>is_dir</function>¡£</para>
+ <para>
+ ²Î¼û <function>is_dir</function>£¬<function>readdir</function>
+ ºÍ <link linkend="class.dir">Dir</link>¡£
+ </para>
</refsect1>
</refentry>