cvs: phpdoc-zh /reference/filesystem/functions fread.xml
| From: | liuming | Date: | Tue, 16 Aug 2005 03:15:35 +0000 |
| Subject: | cvs: phpdoc-zh /reference/filesystem/functions fread.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2299@lists.php.net to get a copy of this message | ||
lm92 Mon Aug 15 23:15:35 2005 EDT
Modified files:
/phpdoc-zh/reference/filesystem/functions fread.xml
Log:
updated to en version
http://cvs.php.net/diff.php/phpdoc-zh/reference/filesystem/functions/fread.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc-zh/reference/filesystem/functions/fread.xml
diff -u phpdoc-zh/reference/filesystem/functions/fread.xml:1.5
phpdoc-zh/reference/filesystem/functions/fread.xml:1.6
--- phpdoc-zh/reference/filesystem/functions/fread.xml:1.5 Mon Aug 18 19:23:46 2003
+++ phpdoc-zh/reference/filesystem/functions/fread.xml Mon Aug 15 23:15:35 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.5 $ -->
-<!-- $Author: dallas $ -->
+<!-- $Revision: 1.6 $ -->
+<!-- $Author: lm92 $ -->
<!-- EN-Revision: 1.14 Maintainer: lm92 Status: ready -->
<!-- CREDITS: dallas -->
<refentry id="function.fread">
@@ -29,9 +29,9 @@
<![CDATA[
// get contents of a file into a string
$filename = "/usr/local/something.txt";
-$handle = fopen ($filename, "r");
-$contents = fread ($handle, filesize ($filename));
-fclose ($handle);
+$handle = fopen($filename, "r");
+$contents = fread($handle, filesize ($filename));
+fclose($handle);
]]>
</programlisting>
</informalexample>
@@ -47,9 +47,9 @@
<programlisting role="php">
<![CDATA[
$filename = "c:\\files\\somepic.gif";
-$handle = fopen ($filename, "rb");
-$contents = fread ($handle, filesize ($filename));
-fclose ($handle);
+$handle = fopen($filename, "rb");
+$contents = fread($handle, filesize ($filename));
+fclose($handle);
]]>
</programlisting>
</informalexample>
@@ -69,14 +69,10 @@
<?php
$handle = fopen ("http://www.example.com/",
"rb");
$contents = "";
-do {
- $data = fread($handle, 8192);
- if (strlen($data) == 0) {
- break;
- }
- $contents .= $data;
-} while(true);
-fclose ($handle);
+while (!feof($handle)) {
+ $contents .= fread($handle, 8192);
+}
+fclose($handle);
?>
]]>
</programlisting>
@@ -84,12 +80,6 @@
</para>
<note>
<para>
- ÉÏÀý±È´«Í³µÄʹÓà while(!<function>feof</function>)
-
µÄ·½·¨ÐÔÄÜÒªºÃ£¬ÒòΪÔÚÿ¸öÑ»·ÖнÚÔ¼Á˺¯Êýµ÷Óõύ·Ñ¡£
- </para>
- </note>
- <note>
- <para>
Èç¹ûÄãÖ»ÊÇÏ뽫һ¸öÎļþµÄÄÚÈݶÁÈëµ½Ò»¸ö×Ö·û´®ÖУ¬ÓÃ
<function>file_get_contents</function>£¬ËüµÄÐÔÄܱÈÉÏÃæµÄ´úÂëºÃµÃ¶à¡£
</para>