array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.fflush.php', 1 => 'fflush', ), 'up' => array ( 0 => 'ref.filesystem.php', 1 => 'Funciones del Sistema de Archivos', ), 'prev' => array ( 0 => 'function.feof.php', 1 => 'feof', ), 'next' => array ( 0 => 'function.fgetc.php', 1 => 'fgetc', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/filesystem/functions/fflush.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
fflush — Vuelca la salida a un archivo
Esta función fuerza una escritura de todas las salidas del buffer a un recurso
apuntado por el archivo handle
.
handle
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()).
Ejemplo #1 Ejemplo de escritura de un archivo usando fflush()
<?php
$nombre_archivo = 'bar.txt';
$archivo = fopen($nombre_archivo, 'r+');
rewind($archivo);
fwrite($archivo, 'Foo');
fflush($archivo);
ftruncate($archivo, ftell($archivo));
fclose($archivo);
?>