PHP fflush() 函数用法及示例 - PHP教程

由网友 大卫 发布 阅读 2

PHP fflush() 函数用法及示例 - PHP教程

PHP Filesystem 参考手册

fflush()函数将所有缓冲的输出写入打开的文件,如果成功,则返回true,否则返回false。

语法

bool fflush ( resource $handle )

该函数强制将所有缓冲的输出写入文件句柄指向的资源。

在线示例

<?php
   $file = fopen("/PhpProject/sample.txt", "r+");

   // some code
   fflush($file);
   
   echo $file;
   fclose($file);
?>

输出结果

Resource id #5

PHP Filesystem 参考手册

PHP fgetc() PHP filectime()