cvs: phpdoc-zh /reference/filesystem/functions fopen.xml
| From: | liuming | Date: | Tue, 04 Feb 2003 10:30:15 +0000 |
| Subject: | cvs: phpdoc-zh /reference/filesystem/functions fopen.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1009@lists.php.net to get a copy of this message | ||
lm92 Tue Feb 4 05:30:15 2003 EDT
Modified files:
/phpdoc-zh/reference/filesystem/functions fopen.xml
Log:
finished
Index: phpdoc-zh/reference/filesystem/functions/fopen.xml
diff -u phpdoc-zh/reference/filesystem/functions/fopen.xml:1.1
phpdoc-zh/reference/filesystem/functions/fopen.xml:1.2
--- phpdoc-zh/reference/filesystem/functions/fopen.xml:1.1 Sun Sep 29 22:56:19 2002
+++ phpdoc-zh/reference/filesystem/functions/fopen.xml Tue Feb 4 05:30:14 2003
@@ -1,15 +1,17 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<?xml version="1.0" encoding="gb2312"?>
+<!-- $Revision: 1.2 $ -->
+<!-- $Author: lm92 $ -->
+<!-- EN-Revision: 1.3 Maintainer: Liuming1 Status: ready -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 -->
<refentry id="function.fopen">
<refnamediv>
<refname>fopen</refname>
- <refpurpose>Opens file or URL</refpurpose>
+ <refpurpose>´ò¿ªÎļþ»òÕßURL</refpurpose>
</refnamediv>
<refsect1>
- <title>Description</title>
+ <title>ÃèÊö</title>
<methodsynopsis>
- <type>int</type><methodname>fopen</methodname>
+ <type>resource</type><methodname>fopen</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam>
@@ -30,7 +32,7 @@
If PHP has decided that <parameter>filename</parameter> specifies
a local file, then it will try to open a stream on that file.
The file must be accessible to PHP, so you need to ensure that
- the file access permissions allow this access.
+ the file access permissions allow this access.
If you have enabled <link linkend="ini.safe-mode">safe_mode</link>,
or <link linkend="ini.open-basedir">open_basedir</link> further
restrictions may apply.
@@ -45,86 +47,77 @@
</simpara>
<note>
<simpara>
- The list of supported protocols can be found in <xref linkend="wrappers"/>.
+ Äã¿ÉÒÔÔÚ <xref linkend="wrappers"/> ÕÒµ½Ö§³ÖµÄÐÒé¡£
</simpara>
</note>
<para>
- <parameter>mode</parameter> specifies the type of access you
- require to the stream. It may be any of the following:
+ <parameter>mode</parameter> Ö¸¶¨ÁË´ò¿ªÎļþµÄ·½Ê½£¬
+ Ëü¿ÉÒÔÊÇÒÔϵļ¸ÖÖÇé¿ö£º
<itemizedlist>
<listitem>
<simpara>
- 'r' - Open for reading only; place the file pointer at the
- beginning of the file.
+ 'r' -
ÒÔÖ»¶Á·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·¡£
</simpara>
</listitem>
<listitem>
<simpara>
- 'r+' - Open for reading and writing; place the file pointer at
- the beginning of the file.
+ 'r+' -
ÒԿɶÁд·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·¡£
</simpara>
</listitem>
<listitem>
<simpara>
- 'w' - Open for writing only; place the file pointer at the
- beginning of the file and truncate the file to zero length.
- If the file does not exist, attempt to create it.
+ 'w' -
ÒÔֻд·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·²¢Çå³ýÎļþÄÚµÄËùÓÐÄÚÈÝ¡£
+ Èç¹ûÎļþ²»´æÔÚ£¬Ôò³¢ÊÔ½¨Á¢¡£
</simpara>
</listitem>
<listitem>
<simpara>
- 'w+' - Open for reading and writing; place the file pointer at
- the beginning of the file and truncate the file to zero
- length. If the file does not exist, attempt to create it.
+ 'w+' -
ÒԿɶÁд·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·²¢Çå³ýÎļþÄÚµÄËùÓÐÄÚÈÝ¡£
+ Èç¹ûÎļþ²»´æÔÚ£¬Ôò³¢ÊÔ½¨Á¢¡£
</simpara>
</listitem>
<listitem>
<simpara>
- 'a' - Open for writing only; place the file pointer at the end
- of the file. If the file does not exist, attempt to create
- it.
+ 'a' -
ÒÔֻд·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·¡£
+ Èç¹ûÎļþ²»´æÔÚ£¬Ôò³¢ÊÔ½¨Á¢¡£
</simpara>
</listitem>
<listitem>
<simpara>
- 'a+' - Open for reading and writing; place the file pointer at
- the end of the file. If the file does not exist, attempt to
- create it.
+ 'a+' -
ÒԿɶÁд·½Ê½´ò¿ªÎļþ£»°ÑÎļþÖ¸Õë·Åµ½Îļþ¿ªÍ·¡£
+ Èç¹ûÎļþ²»´æÔÚ£¬Ôò³¢ÊÔ½¨Á¢¡£
</simpara>
</listitem>
</itemizedlist>
</para>
<note>
<para>
- The <parameter>mode</parameter> may contain the letter
- 'b'. This is useful only on systems which differentiate between
- binary and text files (i.e. Windows. It's useless on Unix).
- If not needed, this will be ignored. You are encouraged to
- include the 'b' flag in order to make your scripts more portable.
+ ¿ÉÒÔÔÚ <parameter>mode</parameter> ÄÚ¼ÓÈë×Öĸ¡®b¡¯¡£
+
ËüÖ»ÔÚÇø·Ö¶þ½øÖÆÎļþºÍÎı¾ÎļþµÄϵͳÉÏÓÐÓã¨ÀýÈç
Windows¡£Ëü¶ÔÓÚUnix²»Æð×÷Óã©¡£
+
Èç¹û²»ÐèÒª£¬¿ÉÒÔºöÂÔ¡£ÍƼöÄúÓá®b¡¯Ê¹ÄúµÄ´úÂë¸üÇá±ã¡£
</para>
</note>
<para>
- The optional third <parameter>use_include_path</parameter> parameter
- can be set to '1' or &true; if you want to search for the file in
- the <link linkend="ini.include-path">include_path</link>, too.
+ Èç¹ûÄãÒªÔÚ <link
linkend="ini.include-path">include_path</link> ÀïËÑË÷ÎļþµÄ»°£¬
+ ¿ÉÒÔ½«µÚÈý¸ö²ÎÊý <parameter>use_include_path</parameter>
ÉèΪ¡®1¡¯»ò &true;¡£
</para>
<para>
- The optional fourth <parameter>zcontext</parameter> is used for
+ The optional fourth <parameter>zcontext</parameter> is used for
specifying tuning parameters and callbacks.
</para>
<simpara>
- If the open fails, the function returns &false;.
+ Èç¹û´ò¿ªÊ§°Ü£¬º¯Êý»á·µ»Ø &false;.
</simpara>
<para>
<example>
- <title><function>fopen</function> example</title>
+ <title><function>fopen</function> µÄ·¶Àý</title>
<programlisting role="php">
<![CDATA[
<?php
-$fp = fopen ("/home/rasmus/file.txt", "r");
-$fp = fopen ("/home/rasmus/file.gif", "wb");
-$fp = fopen ("http://www.example.com/",
"r");
-$fp = fopen ("ftp://user:password@example.com/",
"w");
+$handle = fopen ("/home/rasmus/file.txt", "r");
+$handle = fopen ("/home/rasmus/file.gif", "wb");
+$handle = fopen ("http://www.example.com/",
"r");
+$handle = fopen ("ftp://user:password@example.com/somefile.txt",
"w");
?>
]]>
</programlisting>
@@ -137,22 +130,21 @@
accessible to the server process.
</simpara>
<para>
- On the Windows platform, be careful to escape any backslashes
- used in the path to the file, or use forward slashes.
+
ÔÚWindowsƽ̨£¬Ð¡ÐÄ©µôÎļþ·¾¶ÖеÄÈκÎÒ»¸ö·´Ð±¸Ü»òб¸Ü¡£
<informalexample>
- <programlisting role="php">
+ <programlisting role="php">
<![CDATA[
<?php
-$fp = fopen ("c:\\data\\info.txt", "r");
+$handle = fopen ("c:\\data\\info.txt", "r");
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
- See also <xref linkend="wrappers"/>,
+ ²Î¼û <xref linkend="wrappers"/>,
<function>fclose</function>,
- <function>fgets</function>,
+ <function>fgets</function>,
<function>fsockopen</function>,
<function>file</function>,
<function>file_exists</function>,