PHP 8.5.0 Alpha 1 available for testing

ob_get_flush

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

ob_get_flush Vacía (envía) el valor de retorno del gestor de salida activo, devuelve el contenido del búfer de salida activo y lo desactiva.

Descripción

ob_get_flush(): string|false

Esta función llama al gestor de salida (con el flag PHP_OUTPUT_HANDLER_FINAL), envía (vacía) su valor de retorno, devuelve el contenido del búfer de salida activo y desactiva el búfer de salida activo.

ob_get_flush() fallará sin un búfer de salida activo iniciado con el flag PHP_OUTPUT_HANDLER_REMOVABLE.

ob_get_flush() vaciará (enviará) el valor de retorno del gestor de salida incluso si el búfer de salida activo ha sido iniciado sin el flag PHP_OUTPUT_HANDLER_FLUSHABLE.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Devuelve el contenido del búfer de salida activo en caso de éxito o false en caso de fallo.

Errores/Excepciones

En caso de fallo de la función, genera una E_NOTICE.

Ejemplos

Ejemplo #1 Ejemplo con ob_get_flush()

<?php
//Utilización de output_buffering=On
print_r(ob_list_handlers());

//Guardado del búfer en un fichero
$buffer = ob_get_flush();
file_put_contents('buffer.txt', $buffer);

print_r(ob_list_handlers());
?>

El resultado del ejemplo sería:

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

Ver también

  • ob_start() - Activa el temporizador de salida
  • ob_get_contents() - Devuelve el contenido del búfer de salida
  • ob_flush() - Vacía (envía) el valor de retorno del manejador de salida activo.
  • ob_end_flush() - Vacía (envía) el valor de retorno del manejador de salida activo y desactiva el búfer de salida activo
  • ob_get_clean() - Obtiene el contenido del búfer de salida activo y lo desactiva

add a note

User Contributed Notes 1 note

up
36
info at pcdoctor dot fr
17 years ago
Hi,
this is just to add a behavior that I haven't understud at first place.

ob_get_flush actually returns the content of the buffer as a text but also it sends the buffer back to the browser so that it's displayed on user screen.

Use ob_get_clean if you do not want the buffer to be send to the user
To Top