fflush

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

fflush — ����������������ļ�

˵��

fflush ( resource $handle ) : bool

������ǿ�ƽ����л�������д�� handle �ļ������ָ�����Դ�� �ɹ�ʱ���� TRUE�� ������ʧ��ʱ���� FALSE��

�ļ�ָ���������Ч�ģ�����ָ���� fopen() �� fsockopen() �ɹ��򿪵��ļ�(����δ�� fclose() �ر�)��

����

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);
?>

�μ�

  • clearstatcache() - ����ļ�״̬����
  • fwrite() - д���ļ����ɰ�ȫ���ڶ������ļ���