(PHP 8 >= 8.1.0)
fsync — 同步文件变更(包括元数据)
$stream
此函数同步文件变更,包括元数据。与 fflush() 类似,但同时还让操作系统将变更写入到存储介质。
stream
成功时返回 true, 或者在失败时返回 false。
true
false
示例 #1 fsync() 示例
<?php $file = 'test.txt'; $stream = fopen($file, 'w'); fwrite($stream, 'test data'); fwrite($stream, "\r\n"); fwrite($stream, 'additional data'); fsync($stream); fclose($stream); ?>