reference/outcontrol/functions/ob-get-clean.xml
86b976d5afaf037868174fe5c242e886eb69baa4
...
...
@@ -3,7 +3,7 @@
3
3
<refentry xml:id="function.ob-get-clean" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>ob_get_clean</refname>
6
-
<refpurpose>Get current buffer contents and delete current output buffer</refpurpose>
6
+
<refpurpose>Get the contents of the active output buffer and turn it off</refpurpose>
7
7
</refnamediv>
8
8

9
9
<refsect1 role="description">
...
...
@@ -13,20 +13,23 @@
13
13
<void/>
14
14
</methodsynopsis>
15
15
<para>
16
-
Gets the current buffer contents and delete current output buffer.
16
+
This function calls the output handler
17
+
(with the <constant>PHP_OUTPUT_HANDLER_CLEAN</constant> and
18
+
<constant>PHP_OUTPUT_HANDLER_FINAL</constant> flags),
19
+
discards it's return value,
20
+
returns the contents of the active output buffer
21
+
and turns off the active output buffer.
17
22
</para>
18
23
<para>
19
-
<function>ob_get_clean</function> essentially executes both
20
-
<function>ob_get_contents</function> and
21
-
<function>ob_end_clean</function>.
24
+
<function>ob_get_clean</function> will fail
25
+
without an active output buffer started with the
26
+
<constant>PHP_OUTPUT_HANDLER_REMOVABLE</constant> flag.
22
27
</para>
23
28
<para>
24
-
The output buffer must be started by
25
-
<function>ob_start</function> with <link
26
-
linkend="constant.php-output-handler-cleanable">PHP_OUTPUT_HANDLER_CLEANABLE</link>
27
-
and <link
28
-
linkend="constant.php-output-handler-removable">PHP_OUTPUT_HANDLER_REMOVABLE</link>
29
-
flags. Otherwise <function>ob_get_clean</function> will not work.
29
+
<function>ob_get_clean</function>
30
+
will discard the contents of the active output buffer
31
+
even if it was started without the
32
+
<constant>PHP_OUTPUT_HANDLER_CLEANABLE</constant> flag.
30
33
</para>
31
34
</refsect1>
32
35

...
...
@@ -38,8 +41,22 @@
38
41
<refsect1 role="returnvalues">
39
42
&reftitle.returnvalues;
40
43
<para>
41
-
Returns the contents of the output buffer and end output buffering.
42
-
If output buffering isn't active then &false; is returned.
44
+
Returns the contents of the active output buffer on success
45
+
or &false; on failure.
46
+
</para>
47
+
<caution>
48
+
<simpara>
49
+
<function>ob_get_clean</function> will return false
50
+
but will not generate an <constant>E_NOTICE</constant>
51
+
if there is no active output buffer.
52
+
</simpara>
53
+
</caution>
54
+
</refsect1>
55
+

56
+
<refsect1 role="errors">
57
+
&reftitle.errors;
58
+
<para>
59
+
If the function fails it generates an <constant>E_NOTICE</constant>.
43
60
</para>
44
61
</refsect1>
45
62

...
...
@@ -79,8 +96,11 @@ string(11) "hello world"
79
96
&reftitle.seealso;
80
97
<para>
81
98
<simplelist>
82
-
<member><function>ob_get_contents</function></member>
83
99
<member><function>ob_start</function></member>
100
+
<member><function>ob_get_contents</function></member>
101
+
<member><function>ob_clean</function></member>
102
+
<member><function>ob_end_clean</function></member>
103
+
<member><function>ob_get_flush</function></member>
84
104
</simplelist>
85
105
</para>
86
106
</refsect1>
87
107