fflush

(PHP 4 >= 4.0.1, PHP 5, PHP 7)
Flushes the output to a file
bool fflush ( resource $handle )

This function forces a write of all buffered output to the resource pointed to by the file handle.

Parameters:
handle

The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).

Returns:

Returns TRUE on success or FALSE on failure.

Examples:
File write example using fflush()
<?php
$filename = 'bar.txt';

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

See also:

clearstatcache() -

fwrite() -

doc_php
2016-02-24 15:56:46
Comments
Leave a Comment

Please login to continue.