Revision: 222
Author: cztvictor
Date: Tue Nov 1 08:05:33 2011
Log: 标题:[PHPDOC-ZH] [翻译] 函数参考\Output Contorl部分
内容:
翻译网址http://svn.php.net/viewvc/phpdoc/en/trunk/reference/outcontrol/下的
所有页面文档
个人信息: 中文名 蔡泽廷 英文名:Victor Choy QQ:415708270
http://code.google.com/p/phpdoc-zh/source/detail?r=222
Added:
/trunk/xml/reference/outcontrol
/trunk/xml/reference/outcontrol/book.xml
/trunk/xml/reference/outcontrol/examples.xml
/trunk/xml/reference/outcontrol/functions
/trunk/xml/reference/outcontrol/functions/ob-clean.xml
/trunk/xml/reference/outcontrol/functions/ob-end-clean.xml
/trunk/xml/reference/outcontrol/functions/ob-end-flush.xml
/trunk/xml/reference/outcontrol/functions/ob-flush.xml
/trunk/xml/reference/outcontrol/functions/ob-get-clean.xml
/trunk/xml/reference/outcontrol/functions/ob-get-contents.xml
/trunk/xml/reference/outcontrol/functions/ob-get-flush.xml
/trunk/xml/reference/outcontrol/functions/ob-get-length.xml
/trunk/xml/reference/outcontrol/functions/ob-get-level.xml
/trunk/xml/reference/outcontrol/functions/ob-get-status.xml
/trunk/xml/reference/outcontrol/functions/ob-gzhandler.xml
/trunk/xml/reference/outcontrol/functions/ob-implicit-flush.xml
/trunk/xml/reference/outcontrol/functions/ob-list-handlers.xml
/trunk/xml/reference/outcontrol/functions/ob-start.xml
/trunk/xml/reference/outcontrol/functions/output-add-rewrite-var.xml
/trunk/xml/reference/outcontrol/functions/output-reset-rewrite-vars.xml
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/book.xml Tue Nov 1 08:05:33 2011
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 313269 $ -->
+<!-- $EN-Revision:: 313269 $ -->
+
+<!-- Membership: core -->
+
+<book xml:id="book.outcontrol" xmlns="
http://docbook.org/ns/docbook">
+ <title>输出缓冲控制</title>
+ <titleabbrev>输出控制</titleabbrev>
+
+ <preface xml:id="intro.outcontrol">
+ &reftitle.intro;
+ <para>
+ 当PHP脚本有输出时,输出控制函数可以用这些来控制输出。这在多种不同情况中
非常有用,尤其是用来在脚本开始输出 数据后,发送http头信息到浏览器。输出控
制函数不影响由
+ <function>header</function> 或 <function>setcookie</function>发送的文件
头信息,仅影响象
+ <function>echo</function>这样的函数和PHP代码块间的数据。
+ </para>
+ <note>
+ <para>
+ 由于早先的版本的缺陷,当从PHP4.1.x(4.2.x,4.3.x)升级时,必须保证
&php.ini;中的<literal>implicit_flush</literal> 是 <literal>OFF</literal>,
否则任何用<function>ob_start</function>的输出将在输出中隐藏掉。
+ </para>
+ </note>
+ </preface>
+
+ &reference.outcontrol.setup;
+ &reference.outcontrol.constants;
+ &reference.outcontrol.examples;
+ &reference.outcontrol.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
+-->
+
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/examples.xml Tue Nov 1 08:05:33 2011
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 310851 $ -->
+<!-- $EN-Revision: 310851 $ -->
+<appendix xml:id="outcontrol.examples"
xmlns="
http://docbook.org/ns/docbook"
xmlns:xlink="
http://www.w3.org/1999/xlink">
+ &reftitle.examples;
+ <section xml:id="outcontrol.examples.basic">
+ <title>Basic usage</title>
+ <para>
+ <example>
+ <title>Output Control example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+ob_start();
+echo "Hello\n";
+
+setcookie("cookiename", "cookiedata");
+
+ob_end_flush();
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 在上面的例子中,<function>echo</function>函数的输出将一直被保存在输出缓
冲区中直到调用
+ <function>ob_end_flush</function> 。同时,对
<function>setcookie</function>的调用也成功存储了一个cookie,而不会引起错误。
(正常情况下,在数据被发送到浏览器后,就不能再发送http头信息了。)
+ </para>
+ </section>
+</appendix>
+
+<!-- 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
+-->
+
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-clean.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook" xml:id="function.ob-clean">
+ <refnamediv>
+ <refname>ob_clean</refname>
+ <refpurpose>清空(擦掉)输出缓冲区</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>void</type><methodname>ob_clean</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 此函数用来丢弃输出缓冲区中的内容。
+ </para>
+ <para>
+ 此函数不会销毁输出缓冲区,而像
+ <function>ob_end_clean</function> 函数会销毁输出缓冲区。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.void;
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_flush</function></member>
+ <member><function>ob_end_flush</function></member>
+ <member><function>ob_end_clean</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-end-clean.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-end-clean">
+ <refnamediv>
+ <refname>ob_end_clean</refname>
+ <refpurpose>清空(擦除)缓冲区并关闭输出缓冲</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>ob_end_clean</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 此函数丢弃最顶层输出缓冲区的内容并关闭这个缓冲区。如果想要进一步处理缓冲
区的内容,必须在<function>ob_end_clean</function>之前调用
<function>ob_get_contents</function>,因为当调用
<function>ob_end_clean</function>时缓冲区内容将被丢弃。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success; 错误的原因首先是,在调用时没有一个起作用的缓冲区,或者
是因为某些原因缓冲区不能被删除(可能对特殊缓冲区而言)。
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ 如果函数失败了,将引发一个<constant>E_NOTICE</constant>异常。
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.2.0</entry>
+ <entry>
+ 添加了布尔返回值。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ 下面的例子给出了一种去除所有输出缓冲区的方法:
+ </para>
+ <para>
+ <example>
+ <title><function>ob_end_clean</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ob_start();
+echo 'Text that won\'t get displayed.';
+ob_end_clean();
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_get_contents</function></member>
+ <member><function>ob_flush</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-end-flush.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-end-flush">
+ <refnamediv>
+ <refname>ob_end_flush</refname>
+ <refpurpose>冲刷出(送出)输出缓冲区内容并关闭缓冲</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>ob_end_flush</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 这个函数将送出最顶层缓冲区的内容(如果里边有内容的话),并关闭缓冲区。如
果想进一步处理缓冲区中的内容,必须在<function>ob_end_flush</function>之前调
用
+ <function>ob_get_contents</function>,因为在调用
<function>ob_end_flush</function>后缓冲区内容被丢弃。
+ </para>
+ <note>
+ <simpara>
+ 这个函数与<function>ob_get_flush</function>相似,不同的是
<function>ob_get_flush</function>会把缓冲区中的内容作为字符串返回。
+ </simpara>
+ </note>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success; 错误的原因首先是,在调用时没有一个起作用的缓冲区,或者
是因为某些原因缓冲区不能被删除(可能对特殊缓冲区而言)。
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ 如果函数失败了,将引发一个<constant>E_NOTICE</constant>异常。
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.2.0</entry>
+ <entry>
+ 添加了布尔返回值。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>ob_end_flush</function> example</title>
+ <para>
+ 下面的例子给出了一种送出缓冲区内容并关闭所有输出缓冲区的容易的方法:
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ while (@ob_end_flush());
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_get_contents</function></member>
+ <member><function>ob_get_flush</function></member>
+ <member><function>ob_flush</function></member>
+ <member><function>ob_end_clean</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-flush.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook" xml:id="function.ob-flush">
+ <refnamediv>
+ <refname>ob_flush</refname>
+ <refpurpose>冲刷出(送出)输出缓冲区中的内容</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>void</type><methodname>ob_flush</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 这个函数将送出缓冲区的内容(如果里边有内容的话)。如果想进一步处理缓冲区
中的内容,必须在<function>ob_flush</function>之前调用
<function>ob_get_contents</function> ,因为在调用
<function>ob_flush</function>之后缓冲区内容将被丢弃。
+ </para>
+ <para>
+ 此函数不会销毁输出缓冲区,而像<function>ob_end_flush</function> 函数会销
毁缓冲区。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.void;
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_get_contents</function></member>
+ <member><function>ob_clean</function></member>
+ <member><function>ob_end_flush</function></member>
+ <member><function>ob_end_clean</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-clean.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-clean">
+ <refnamediv>
+ <refname>ob_get_clean</refname>
+ <refpurpose>得到当前缓冲区的内容并删除当前输出缓。</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>string</type><methodname>ob_get_clean</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>得到当前缓冲区的内容并删除当前输出缓冲区。
+ </para>
+ <para>
+ <function>ob_get_clean</function> 实质上是一起执行了
+ <function>ob_get_contents</function> 和
+ <function>ob_end_clean</function>。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 返回输出缓冲区的内容,并结束输出缓冲区。如果输出缓冲区不是活跃的,即返
回 &false; 。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>A simple <function>ob_get_clean</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+ob_start();
+
+echo "Hello World";
+
+$out = ob_get_clean();
+$out = strtolower($out);
+
+var_dump($out);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+
+string(11) "hello world"
+
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_get_contents</function></member>
+ <member><function>ob_start</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-contents.xml Tue Nov
1 08:05:33 2011
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-contents">
+ <refnamediv>
+ <refname>ob_get_contents</refname>
+ <refpurpose>返回输出缓冲区的内容</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>string</type><methodname>ob_get_contents</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 只是得到输出缓冲区的内容,但不清除它。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 此函数返回输出缓冲区的内容,或者如果输出缓冲区无效将返回&false; 。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>A simple <function>ob_get_contents</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+ob_start();
+
+echo "Hello ";
+
+$out1 = ob_get_contents();
+
+echo "World";
+
+$out2 = ob_get_contents();
+
+ob_end_clean();
+
+var_dump($out1, $out2);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+string(6) "Hello "
+string(11) "Hello World"
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_get_length</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-flush.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 315005 $ -->
+<!-- $EN-Revision: 315005 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-flush">
+ <refnamediv>
+ <refname>ob_get_flush</refname>
+ <refpurpose>刷出(送出)缓冲区内容,以字符串形式返回内容,并关闭输出缓冲
区。</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>string</type><methodname>ob_get_flush</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ <function>ob_get_flush</function>
+ 刷出(送出)缓冲区内容,以字符串形式返回内容,并关闭输出缓冲区。
+ </para>
+ <note>
+ <simpara>
+ 这个函数与<function>ob_end_flush</function>相似,不同的是本函数还会以字
符串形式返回缓冲区内容。
+ </simpara>
+ </note>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 返回输出缓冲区的内容;或者是,如果没有起作用的输出缓冲区,返回&false; 。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>ob_get_flush</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+//using output_buffering=On
+print_r(ob_list_handlers());
+
+//save buffer in a file
+$buffer = ob_get_flush();
+file_put_contents('buffer.txt', $buffer);
+
+print_r(ob_list_handlers());
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => default output handler
+)
+Array
+(
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_end_clean</function></member>
+ <member><function>ob_end_flush</function></member>
+ <member><function>ob_list_handlers</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-length.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-length">
+ <refnamediv>
+ <refname>ob_get_length</refname>
+ <refpurpose>返回输出缓冲区内容的长度</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>int</type><methodname>ob_get_length</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 此函数将返回输出缓中冲区内容的长度。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 返回输出缓冲区内容的长度;或者返回&false;——如果没有起作用的缓冲区。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>A simple <function>ob_get_length</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+ob_start();
+
+echo "Hello ";
+
+$len1 = ob_get_length();
+
+echo "World";
+
+$len2 = ob_get_length();
+
+ob_end_clean();
+
+echo $len1 . ", ." . $len2;
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+6, 11
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_get_contents</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-level.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-level">
+ <refnamediv>
+ <refname>ob_get_level</refname>
+ <refpurpose>返回输出缓冲机制的嵌套级别</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>int</type><methodname>ob_get_level</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 返回输出缓冲机制的嵌套级别。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 返回嵌套的输出缓冲处理程序的级别;或者是,如果输出缓冲区不起作用,返回
零。
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_get_contents</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-get-status.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-get-status">
+ <refnamediv>
+ <refname>ob_get_status</refname>
+ <refpurpose>得到所有输出缓冲区的状态</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>array</type><methodname>ob_get_status</methodname>
+ <methodparam choice="opt"><type>bool</type>
<parameter>full_status</parameter>
<initializer>FALSE</initializer></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>ob_get_status</function>返回最顶层输出缓冲区的状态信息;或者如
果<parameter>full_status</parameter>设为&true;,返回所有有效的输出缓冲级别。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>full_status</parameter></term>
+ <listitem>
+ <para>
+ 设为&true; 返回所有有效的输出缓冲区级别的状态信息。如果设为 &false; 或
者没有设置,仅返回最 顶层输出缓冲区的状态信息。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 如果调用时没有<parameter>full_status</parameter>参数,或者
<parameter>full_status</parameter> = &false; 将返回一个包含下面元素的简单数
组:
+ <informalexample>
+ <screen>
+<![CDATA[
+Array
+(
+ [level] => 2
+ [type] => 0
+ [status] => 0
+ [name] => URL-Rewriter
+ [del] => 1
+)
+]]>
+ </screen>
+ </informalexample>
+ <segmentedlist>
+ <title>Simple <function>ob_get_status</function> results</title>
+ <segtitle>Key</segtitle><segtitle>Value</segtitle>
+ <seglistitem><seg>level</seg><seg>输出嵌套级别</seg></seglistitem>
+ <seglistitem><seg>type</seg><seg><literal>PHP_OUTPUT_HANDLER_INTERNAL
(0)</literal> 或者 <literal>PHP_OUTPUT_HANDLER_USER
(1)</literal></seg></seglistitem>
+
<seglistitem><seg>status</seg><seg><literal>PHP_OUTPUT_HANDLER_START</literal>
(0), <literal>PHP_OUTPUT_HANDLER_CONT</literal> (1) or
<literal>PHP_OUTPUT_HANDLER_END</literal> (2)</seg>三个之一</seglistitem>
+ <seglistitem><seg>name</seg><seg>起作用的输出处理程序的名字,或者是默认
的输出处理程序的名字(如果没有设置的话)</seg></seglistitem>
+ <seglistitem><seg>del</seg><seg>由<function>ob_start</function>设置的删
除标签(Erase-flag)</seg></seglistitem>
+ </segmentedlist>
+ </para>
+ <para>
+ 如果调用时<parameter>full_status</parameter> = &true;,将返回一个数
组,该数组的每个元素包含有效的输出缓冲区级别的状态信息。缓冲区的级别数用来当
作数组的第一维数;每个元素自身是另一个数组,它持有该有效输出级别的状态信息。
+ <informalexample>
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => Array
+ (
+ [chunk_size] => 0
+ [size] => 40960
+ [block_size] => 10240
+ [type] => 1
+ [status] => 0
+ [name] => default output handler
+ [del] => 1
+ )
+
+ [1] => Array
+ (
+ [chunk_size] => 0
+ [size] => 40960
+ [block_size] => 10240
+ [type] => 0
+ [buffer_size] => 0
+ [status] => 0
+ [name] => URL-Rewriter
+ [del] => 1
+ )
+
+)
+]]>
+ </screen>
+ </informalexample>
+ </para>
+ <para>
+ 完整的输出包含以下附加元素:
+ <segmentedlist>
+ <title>完整的<function>ob_get_status</function> 结果</title>
+ <segtitle>Key</segtitle><segtitle>Value</segtitle>
+ <seglistitem><seg>chunk_size</seg><seg>由
<function>ob_start</function>设置的Chunk size值</seg></seglistitem>
+ <seglistitem><seg>size</seg><seg>...</seg></seglistitem>
+ <seglistitem><seg>blocksize</seg><seg>...</seg></seglistitem>
+ </segmentedlist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_get_level</function></member>
+ <member><function>ob_list_handlers</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-gzhandler.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-gzhandler">
+ <refnamediv>
+ <refname>ob_gzhandler</refname>
+ <refpurpose>在ob_start中使用的用来压缩输出缓冲区中内容的回调函数。
ob_start callback function to gzip output buffer</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>string</type><methodname>ob_gzhandler</methodname>
+
<methodparam><type>string</type><parameter>buffer</parameter></methodparam>
+ <methodparam><type>int</type><parameter>mode</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>ob_gzhandler</function>目的是用在
<function>ob_start</function>中作回调函数,以方便将gz 编码的数据发送到支持
压缩页面的浏览器。在<function>ob_gzhandler</function>真正发送压缩过的数据之
前,该 函数会确定(判定)浏览器可以接受哪种类型内容编码
("gzip","deflate",或者根本什么都不支持),然后 返回相应的输出。
+ 所有可以发送正确头信息表明他自己可以接受压缩的网页的浏览器,都可以支持。
+ All browsers are supported since it's up to the browser to send the
+ correct header saying that it accepts compressed web pages.
+ 如果一个浏览器不支持压缩过的页面,此函数返回&false;。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>buffer</parameter></term>
+ <listitem>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>mode</parameter></term>
+ <listitem>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.0.5</entry>
+ <entry>
+ 填加了 <parameter>mode</parameter> 参数。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>ob_gzhandler</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+ob_start("ob_gzhandler");
+
+?>
+<html>
+<body>
+<p>This should be a compressed page.</p>
+</html>
+<body>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ <function>ob_gzhandler</function> 需要 <link
+ linkend="ref.zlib">zlib</link> 扩展。
+ </para>
+ </note>
+ <note>
+ <para>
+ 不能同时使用<function>ob_gzhandler</function> 和 <link
+ linkend="ini.zlib.output-compression">zlib.output_compression</link>。
+ 也要注意使用 <link linkend="ini.zlib.output-compression">
+ zlib.output_compression</link> 要优于
<function>ob_gzhandler</function>。
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>ob_end_flush</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-implicit-flush.xml Tue
Nov 1 08:05:33 2011
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-implicit-flush">
+ <refnamediv>
+ <refname>ob_implicit_flush</refname>
+ <refpurpose>打开/关闭绝对刷送</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>void</type><methodname>ob_implicit_flush</methodname>
+ <methodparam
choice="opt"><type>int</type><parameter>flag</parameter><initializer>true</initializer></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>ob_implicit_flush</function>将打开或关闭绝对(隐式)刷送。绝对
(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对
<function>flush</function> 的显式调用。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>flag</parameter></term>
+ <listitem>
+ <para>
+ 设为&true; 打开绝对刷送,反之是 &false; 。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.void;
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>flush</function></member>
+ <member><function>ob_start</function></member>
+ <member><function>ob_end_flush</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-list-handlers.xml Tue Nov
1 08:05:33 2011
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 297028 $ -->
+<!-- $EN-Revision: 297028 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.ob-list-handlers">
+ <refnamediv>
+ <refname>ob_list_handlers</refname>
+ <refpurpose>列出所有使用中的输出处理程序。</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>array</type><methodname>ob_list_handlers</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 列出所有使用中的输出处理程序。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 此函数将返回一个数组,数组元素是正在使用中输出处理程序名(如果存在的输
出处理程序的话)。
+ 如果启用了<link linkend="ini.output-buffering">output_buffering</link>
或者在
+ <function>ob_start</function> 中创建了一个匿名函
数,<function>ob_list_handlers</function> 将返回 "default output
handler"。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>ob_list_handlers</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+//using output_buffering=On
+print_r(ob_list_handlers());
+ob_end_flush();
+
+ob_start("ob_gzhandler");
+print_r(ob_list_handlers());
+ob_end_flush();
+
+// anonymous functions
+ob_start(create_function('$string', 'return $string;'));
+print_r(ob_list_handlers());
+ob_end_flush();
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => default output handler
+)
+
+Array
+(
+ [0] => ob_gzhandler
+)
+
+Array
+(
+ [0] => default output handler
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_end_clean</function></member>
+ <member><function>ob_end_flush</function></member>
+ <member><function>ob_get_flush</function></member>
+ <member><function>ob_start</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/ob-start.xml Tue Nov 1
08:05:33 2011
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 311250 $ -->
+<!-- $EN-Revision: 311250 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook" xml:id="function.ob-start">
+ <refnamediv>
+ <refname>ob_start</refname>
+ <refpurpose>打开输出控制缓冲</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>ob_start</methodname>
+ <methodparam
choice="opt"><type>callback</type><parameter>output_callback</parameter></methodparam>
+ <methodparam
choice="opt"><type>int</type><parameter>chunk_size</parameter></methodparam>
+ <methodparam
choice="opt"><type>bool</type><parameter>erase</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ 此函数将打开输出缓冲。当输出缓冲是活跃的时候,没有输出能从脚本送出(除
http标头外),相反输 出的内容被存储在内部缓冲区中。
+ </para>
+ <para>
+ 内部缓冲区的内容可以用 <function>ob_get_contents</function> 函数复制到
一个字符串变量中。
+ 想要输出存储在内部缓冲区中的内容,可以使用
<function>ob_end_flush</function> 函数。另外,
+ 使用<function>ob_end_clean</function> 函数会静默丢弃掉缓冲区的内容。
+ </para>
+ <warning>
+ <para>
+ 当有正在调用的回调函数时,一些网络服务器(例如Apache)会改变一个脚本的
工作目录。
+ 你可以通过例如
<literal>chdir(dirname($_SERVER['SCRIPT_FILENAME']))</literal>
+ 在回调函数中再把它改回来。
+ </para>
+ </warning>
+ <para>
+ 输出缓冲区是可堆叠的,这即意谓着,当有一个
<function>ob_start</function> 是活跃的时,
+ 你可以调用另一个 <function>ob_start</function> 。
+ 只要确保又正确调用了 <function>ob_end_flush</function> 恰当的次数即可。
+ 如果有多重输出回调函数是活跃的,输出内容会一直按嵌套的顺序依次通过它们而
被过滤。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>output_callback</parameter></term>
+ <listitem>
+ <para>
+ 可选参数 <parameter>output_callback</parameter> 函数可以被指定。
+ 此函数把一个字符串当作参数并返回一个字符串。
+ 此函数在下情况会被调用到:输出缓冲区被( <function>ob_flush</function>,
<function>ob_clean</function> 或者相似的函数)冲刷(送出)或者被清洗的时
候;或者在请求结束之际输出缓冲区内容被冲刷到浏览器时。
+ 当 <parameter>output_callback</parameter> 被调用时,它将收到输出缓冲区
的内容作为参数
+ 并预期返回一个新的输出缓冲区作为结果,这个新返回的输出缓冲区内容将被送
到浏览器。
+ 如果这个 <parameter>output_callback</parameter> 不是一个可以调用的函
数,此函数
+ 会返回 &false; 。
+ </para>
+ <para>
+ 如果回调函数有两个参数,第二个参数会由一个位域补充,该位域由
+ <constant>PHP_OUTPUT_HANDLER_START</constant>,
+ <constant>PHP_OUTPUT_HANDLER_CONT</constant> 和
+ <constant>PHP_OUTPUT_HANDLER_END</constant> 组成。
+ </para>
+ <para>
+ 如果 <parameter>output_callback</parameter> 返回 &false; ,其原来的输
入
+ 内容被直接送到浏览器。
+ </para>
+ <para>
+ 这个参数 <parameter>output_callback</parameter> 可以通过直接给一个
&null;
+ 值而避开。
+ </para>
+ <para>
+ <function>ob_end_clean</function>,
<function>ob_end_flush</function>,
+ <function>ob_clean</function>, <function>ob_flush</function> and
+ <function>ob_start</function> 不能从一个回调函数中调用。
+ 如果从回调函数中调用了它们,产生的行为是不明确的。
+ 如果想要删除缓冲区的内容,从回调函数中返回一个"" (空字符串)。
+ 更不能从一个回调函数中使用像<literal>print_r($expression,
true)</literal>
+ 或<literal>highlight_file($filename, true)</literal> 一样的输出缓冲函
数。
+ </para>
+ <note>
+ <para>
+ 在PHP 4.0.4中, <function>ob_gzhandler</function> 被引入是为了简化把
gz编码过
+ 数据发送到支持压缩网页的浏览器。
+ <function>ob_gzhandler</function> 会判定浏览器可以接受哪种类型的编码内
容,并返回相应
+ 的输出。
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>chunk_size</parameter></term>
+ <listitem>
+ <para>
+ 如果可选参数 <parameter>chunk_size</parameter> 被赋值了,在任何一个能引
起缓冲区的长度等于
+ 或超过 <parameter>chunk_size</parameter> 的输出操作后,缓冲区都会被刷
送。
+ 默认值 0 意味着函数仅在最后被调用,其余的特殊值可以将
<parameter>chunk_size</parameter>
+ 从 1 设定到 4096。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>erase</parameter></term>
+ <listitem>
+ <para>
+ 如果可选参数 <parameter>erase</parameter> 被赋成 &false;,直到脚本执行
完成缓冲区才被删除。
+ 这使得,如果调用了冲刷和清洗(清除)函数,会抛出一个“notice”,并返回
&false; 值。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success;
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <!-- FIXME PHP_6
+ <row>
+ <entry>6.0.0</entry>
+ <entry>
+ Value 1 is no more special.
+ </entry>
+ </row>
+ -->
+ <row>
+ <entry>4.3.2</entry>
+ <entry>
+ 在传递的 <parameter>output_callback</parameter> 不能被执行时,此函数
+ 被改成返回 &false;
+ </entry>
+ </row>
+ <row>
+ <entry>4.2.0</entry>
+ <entry>
+ 添加了 <parameter>erase</parameter> 参数。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>用户自定义回调函数的例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+function callback($buffer)
+{
+ // replace all the apples with oranges
+ return (str_replace("apples", "oranges", $buffer));
+}
+
+ob_start("callback");
+
+?>
+<html>
+<body>
+<p>It's like comparing apples to oranges.</p>
+</body>
+</html>
+<?php
+
+ob_end_flush();
+
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+<html>
+<body>
+<p>It's like comparing oranges to oranges.</p>
+</body>
+</html>
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_get_contents</function></member>
+ <member><function>ob_end_clean</function></member>
+ <member><function>ob_end_flush</function></member>
+ <member><function>ob_implicit_flush</function></member>
+ <member><function>ob_gzhandler</function></member>
+ <member><function>ob_iconv_handler</function></member>
+ <member><function>mb_output_handler</function></member>
+ <member><function>ob_tidyhandler</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/output-add-rewrite-var.xml
Tue Nov 1 08:05:33 2011
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 315005 $ -->
+<!-- $EN-Revision: 315005 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.output-add-rewrite-var">
+ <refnamediv>
+ <refname>output_add_rewrite_var</refname>
+ <refpurpose>添加URL重写器的值(Add URL rewriter values)</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>output_add_rewrite_var</methodname>
+
<methodparam><type>string</type><parameter>name</parameter></methodparam>
+
<methodparam><type>string</type><parameter>value</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ 此函数给URL重写机制添加名/值对。
+ 这种名值对将被添加到URL(以GET参数的形式)和表单(以input隐藏域的形式
),当透明URL重写用
+ <link linkend="ini.session.use-trans-sid">session.use_trans_sid</link>
+ 开启时同样可以添加到session ID。
+ 要注意,绝对URL(http://example.com/..)不能被重写。
+ </para>
+ <para>
+ 此函数的行为由<link
linkend="ini.url-rewriter.tags">url_rewriter.tags</link> &php.ini;
+ 参数控制。
+ </para>
+ <note>
+ <simpara>
+ 如果还没有活跃的输出缓冲区,调用此函数将隐式地开启它。
+ </simpara>
+ </note>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>name</parameter></term>
+ <listitem>
+ <para>
+ 变量名。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>value</parameter></term>
+ <listitem>
+ <para>
+ 变量值。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success;
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>output_add_rewrite_var</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+output_add_rewrite_var('var', 'value');
+
+// some links
+echo '<a href="file.php">link</a>
+<a href="
http://example.com">link2</a>';
+
+// a form
+echo '<form action="script.php" method="post">
+<input type="text" name="var2" />
+</form>';
+
+print_r(ob_list_handlers());
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+<a href="file.php?var=value">link</a>
+<a href="
http://example.com">link2</a>
+
+<form action="script.php" method="post">
+<input type="hidden" name="var" value="value" />
+<input type="text" name="var2" />
+</form>
+
+Array
+(
+ [0] => URL-Rewriter
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>output_reset_rewrite_vars</function></member>
+ <member><function>ob_flush</function></member>
+ <member><function>ob_list_handlers</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/outcontrol/functions/output-reset-rewrite-vars.xml
Tue Nov 1 08:05:33 2011
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 315005 $ -->
+<!-- $EN-Revision: 315005 $ -->
+<refentry xmlns="
http://docbook.org/ns/docbook"
xml:id="function.output-reset-rewrite-vars">
+ <refnamediv>
+ <refname>output_reset_rewrite_vars</refname>
+ <refpurpose>重设URL重写器的值(Reset URL rewriter values)</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>output_reset_rewrite_vars</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 此函数重置URL重写器,移除所有的先前由
<function>output_add_rewrite_var</function>
+ 函数设置的重写变量,或者移除会话机制(如果
<literal>session.use_trans_sid</literal>
+ 在 <function>session_start</function>上进行了设置)。
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success;
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>output_reset_rewrite_vars</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+session_start();
+output_add_rewrite_var('var', 'value');
+
+echo '<a href="file.php">link</a>';
+ob_flush();
+
+output_reset_rewrite_vars();
+echo '<a href="file.php">link</a>';
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+<a href="file.php?PHPSESSID=xxx&var=value">link</a>
+<a href="file.php">link</a>
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>output_add_rewrite_var</function></member>
+ <member><function>ob_flush</function></member>
+ <member><function>ob_list_handlers</function></member>
+ <member><function>session_start</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- 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
+-->