fflush

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

fflushEnvía todo el contenido generado en un fichero

Descripción

fflush(resource $stream): bool

Fuerza la escritura de todos los datos bufferizados en el fichero designado por stream.

Parámetros

stream

El fichero al que se apunta debe ser válido, y debe apuntar a un fichero abierto por fopen() o fsockopen() (y que todavía no esté cerrado por fclose()).

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Ejemplos

Ejemplo #1 Escritura de un fichero utilizando fflush()

<?php
$filename
= 'bar.txt';

$file = fopen($filename, 'r+');
rewind($file);
fwrite($file, 'Foo');
fflush($file);
ftruncate($file, ftell($file));
fclose($file);
?>

Ver también

add a note

User Contributed Notes 1 note

up
19
michaelsy01[NXSPAM] at informantum dot de
6 years ago
A hint for PHP beginners like me:
The buffered output which is write by fflush() has nothing to do with the output buffer which is initiated by the ob_start() function.
To Top