cvs: phpdoc-zh /features remote-files.xml
| From: | da li | Date: | Sun, 14 Jul 2002 22:26:24 +0000 |
| Subject: | cvs: phpdoc-zh /features remote-files.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-87@lists.php.net to get a copy of this message | ||
thomaslio Sun Jul 14 18:26:24 2002 EDT
Added files:
/phpdoc-zh/features remote-files.xml
Log:
complete
Index: phpdoc-zh/features/remote-files.xml
+++ phpdoc-zh/features/remote-files.xml
<?xml version="1.0" encoding="gb18030"?>
<!-- $Revision: 1.10 $ -->
<chapter id="features.remote-files">
<title>ʹÓÃÔ¶³ÌÎļþ</title>
<para>
ÐèÒªÖ§³Ö "URL fopen wrapper" ¹¦ÄÜ£¬ÄãÐèÅäÖÃPHP
(³ý·ÇÄãÃ÷È·µÄʹÓÃ
<option>--disable-url-fopen-wrapper</option> ±êÖ¾ (
Ò»Ö±µ½°æ±¾ 4.0.3) »òÕßÉèÖà <parameter>allow_url_fopen</parameter>
ÔÚ &php.ini ¹Ø±Õ;
(¶ÔÓÚа汾))£¬
Äã¿ÉÒÔʹÓà HTTP ºÍ FTP µØÖ·ÔÚ¸ü¶àº¯ÊýÖУ¬Ò²¿ÉÒÔ°Ñ
ÎļþÃû×÷Ϊ²ÎÊý£¬ °üÀ¨ <function>require</function>
ºÍ <function>include</function> ÉùÃ÷¡£
</para>
<para>
<note>
<para>
Windows°æ±¾µÄ <literal>PHP</literal>
ÔÚµ±Ç°²»Ö§³ÖÒÔϺ¯ÊýµÄ
Ô¶³ÌÎļþ·ÃÎÊ:
<function>include</function>£¬ <function>include_once</function>£¬
<function>require</function> ºÍ <function>require_once</function>¡£
</para>
</note>
</para>
<para>
±ÈÈ磬 Äã¿ÉÒÔʹÓÃÕâ¸öÔÚÔ¶³Ìweb·þÎñÆ÷´ò¿ªÒ»¸öÎļþ£¬
½âÎöÄãÐèÒªÊä³öµÄÊý¾Ý£¬È»ºóʹÓÃÕâЩÊý¾ÝÔÚÊý¾Ý¿â»òÕß¼òµ¥µÄÊä³öµ½ÄãµÄÍøÕ¾¼òµ¥µÄÑùʽƥÅä¡£
</para>
<para>
<example>
<title>»ñµÃÒ»¸öÔ¶³ÌÒ³ÃæµÄ±êÌâ</title>
<programlisting role="php">
<![CDATA[
<?php
$file = fopen ("http://www.example.com/"£¬ "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
while (!feof ($file)) {
$line = fgets ($file£¬ 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<title>(.*)</title>"£¬ $line£¬ $out)) {
$title = $out[1];
break;
}
}
fclose($file);
?>
]]>
</programlisting>
</example>
</para>
<para>
µ±ÄãÁ¬½Óµ½Ò»¸öÓµÓÐÇ¡µ±µÄ·ÃÎÊȨÏÞµÄFTPºÍ¸ÃÎļþ²»´æÔÚµÄʱºò£¬Äã¿ÉÒÔдÎļþ¡£
ÔÚÓû§Á¬½ÓµÄʱºò£¬³ýÁË'ÄäÃû'£¬Äã±ØÐëÖ¸¶¨Ò»¸öÃû×Ö
(ÕýÈ·µÄÃÜÂë)ºÍµØÖ·£¬ ±ÈÈç
'ftp://user:password@ftp.example.com/path/to/file'.
(ËüÃÇÐèÒª»ù±¾µÄÈÏÖ¤£¬Äã¿ÉÒÔʹÓÃÏàͬµÄÓ﷨ȥ·ÃÎÊhttpµÄÎļþ¡£)
</para>
<para>
<example>
<title>±£´æÊý¾Ýµ½Ô¶³Ì·þÎñÆ÷</title>
<programlisting role="php">
<![CDATA[
<?php
$file = fopen ("ftp://ftp.example.com/incoming/outputfile"£¬
"w");
if (!$file) {
echo "<p>Unable to open remote file for writing.\n";
exit;
}
/* Write the data here. */
fputs ($file£¬ $_SERVER['HTTP_USER_AGENT'] . "\n");
fclose ($file);
?>
]]>
</programlisting>
</example>
</para>
<para>
<note>
<para>
Äã¿ÉÒÔ´ÓÉÏÃæµÄÀý×Ó»ñµÃÏ뷨ȥдԶ³Ì·ÃÎÊÈÕÖ¾¡£
µ«´ÓÒÔÉÏÀý×ÓÖУ¬
Äã¿ÉÒÔÓÃfopen()дÄãËùϲ»¶µÄ·ÃÎÊÈÕÖ¾µÄеÄÎļþ
£¬ ÄãÓ¦¸ÃÈ¥¹Û¿´
<function>syslog</function>º¯Êý.
</para>
</note>
</para>
</chapter>
<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->