파일시스템 함수 목록
PHP Manual

fflush

(PHP 4 >= 4.0.1, PHP 5)

fflush — 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 .

인수

handle

파일 포인터는 fopen(), fsockopen()을 통하여 성공적으로 열려, fclose()로 닫지 않은 유효한 파일이여야 합니다.

반환값

성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.

예제

Example #1 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);
?>

참고


파일시스템 함수 목록
PHP Manual