PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ob_get_length> <ob_get_contents
Last updated: Fri, 11 Apr 2008

view this page in

ob_get_flush

(PHP 4 >= 4.3.0, PHP 5)

ob_get_flush — Volcar el búfer de salida, devolverlo como una cadena y deshabilitar el uso de búferes de salida

Descripción

string ob_get_flush ( void )

ob_get_flush() vuelca el búfer de salida, lo devuelve como una cadena y deshabilita el uso de búferes de salida.

Note: Esta función es similar a ob_end_flush(), excepto que esta función devuelve el búfer como una cadena.

Valores retornados

Devuelve el búfer de salida o FALSE si el uso de búferes no está activo.

Ejemplos

Example #1 Ejemplo de ob_get_flush()

<?php
//usando output_buffering=On
print_r(ob_list_handlers());

//guardar búfer en un archivo
$bufer ob_get_flush();
file_put_contents('bufer.txt'$bufer);

print_r(ob_list_handlers());
?>

El resultado del ejemplo seria:

Array
(
    [0] => default output handler
)
Array
(
)



add a note add a note User Contributed Notes
ob_get_flush
zubin@byron
08-Sep-2005 04:28
Correction to previous post: ob_get_clean() is better, ie:

<?php
// start generating html
$html = '<html><head>'; // etc
// start output buffering
ob_start();
// call function which outputs immediately
print_menu();
// append this to $html and empty buffer
$html .= ob_get_clean();
?>
zubin@byron
31-Aug-2005 10:21
I found this function is useful for storing output instead of displaying it. For example, I wanted to use an old function which echoed the ouput but I wanted it in a variable, not outputted immediately. Here's how:

<?php
// start generating html
$html = '<html><head>'; // etc
// start output buffering
ob_start();
// call function which outputs immediately
print_menu();
// append this to $html
$html .= ob_get_flush();
// empty output buffer
ob_clean();
?>

ob_get_length> <ob_get_contents
Last updated: Fri, 11 Apr 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites