reference/outcontrol/functions/ob-get-clean.xml
86b976d5afaf037868174fe5c242e886eb69baa4
...
...
@@ -1,38 +1,62 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ob-get-clean">
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">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>ob_get_clean</methodname>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>ob_get_clean</methodname>
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
-
flag. 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.
28
33
</para>
29
34
</refsect1>
30
35

36
+
<refsect1 role="parameters">
37
+
&reftitle.parameters;
38
+
&no.function.parameters;
39
+
</refsect1>
40
+

31
41
<refsect1 role="returnvalues">
32
42
&reftitle.returnvalues;
33
43
<para>
34
-
Returns the contents of the output buffer and end output buffering.
35
-
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>.
36
60
</para>
37
61
</refsect1>
38
62

...
...
@@ -72,14 +96,16 @@ string(11) "hello world"
72
96
&reftitle.seealso;
73
97
<para>
74
98
<simplelist>
75
-
<member><function>ob_get_contents</function></member>
76
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>
77
104
</simplelist>
78
105
</para>
79
106
</refsect1>
80
107

81
108
</refentry>
82
-

83
109
<!-- Keep this comment at the end of the file
84
110
Local variables:
85
111
mode: sgml
86
112