mirror of
https://github.com/php/doc-zh.git
synced 2026-03-24 07:02:15 +01:00
77 lines
3.1 KiB
XML
77 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- $Revision$ -->
|
||
<!-- EN-Revision: 98d4a70aac9e7e3663282507f2f9ce014227e39d Maintainer: mowangjuanzi Status: ready -->
|
||
<!-- CREDITS: Luffy -->
|
||
<book xml:id="book.stream" xmlns="http://docbook.org/ns/docbook">
|
||
<?phpdoc extension-membership="core" ?>
|
||
<title>Stream</title>
|
||
|
||
<preface xml:id="intro.stream">
|
||
&reftitle.intro;
|
||
<simpara>
|
||
流是概括文件、网络、数据压缩和其它操作的方式,共享一组通用的函数和用途。在其的简单定义中,<literal>stream</literal>
|
||
是表现可流动行为的 <type>resource</type> 对象。也就是说,它可以以线性的方式读写,并且可以 <function>fseek</function>
|
||
到流中的任意位置。
|
||
</simpara>
|
||
<simpara>
|
||
<literal>wrapper</literal> 是附加代码,用于告诉流如何处理指定协议/编码。例如,<literal>http</literal> 封装协议知道如何将 URL
|
||
转换为 <literal>HTTP/1.0</literal> 请求远程服务器上的文件。默认情况下,PHP 内置了很多封装协议(参阅 <xref
|
||
linkend="wrappers"/>),另外也可以直接从 PHP 脚本中使用 <function>stream_wrapper_register</function>
|
||
或者直接从扩展中添加自定义封装协议。
|
||
因为任何种类的封装协议都可以添加到 PHP 中,所以对它们可以做什么并没有限制。使用
|
||
<function>stream_get_wrappers</function> 访问当前已注册封装协议列表。
|
||
</simpara>
|
||
<para>
|
||
流作为 <parameter>scheme</parameter>://<parameter>target</parameter> 引用
|
||
<itemizedlist>
|
||
<listitem>
|
||
<simpara>
|
||
<parameter>scheme</parameter> (string) — 要使用的封装协议名称。示例为
|
||
file、http、https、ftp、ftps、compress.zlib、compress.bz2 和 php。PHP 内置封装协议列表,参阅<xref
|
||
linkend="wrappers"/>。如果没有指定封装协议,函数使用默认值(通常是 <literal>file</literal>://)。
|
||
</simpara>
|
||
</listitem>
|
||
<listitem>
|
||
<simpara>
|
||
<parameter>target</parameter>——取决于要使用的封装协议。对于文件系统相关的流,这通常是所需文件的路径和文件名。对网络相关的流,这通常是主机名,通常跟着路径。再有,请参阅<xref
|
||
linkend="wrappers"/> 获取对流内置目标的描述。
|
||
</simpara>
|
||
</listitem>
|
||
</itemizedlist>
|
||
</para>
|
||
</preface>
|
||
|
||
&reference.stream.setup;
|
||
&reference.stream.constants;
|
||
&reference.stream.filters;
|
||
&reference.stream.contexts;
|
||
&reference.stream.errors;
|
||
&reference.stream.examples;
|
||
&reference.stream.php-user-filter;
|
||
&reference.stream.streamwrapper;
|
||
&reference.stream.reference;
|
||
|
||
</book>
|
||
|
||
<!-- 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:"~/.phpdoc/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
|
||
-->
|
||
|