Does not flush st_atime, st_mtime or st_size.
If you need to use filesize after a write you will need need fsync() or fflush() instead.
(PHP 8 >= 8.1.0)
fdatasync — 同步文件数据(不包含元数据)
此函数同步 stream
的内容到存储介质,就像是 fsync()
所做的那样,但不会同步文件元数据。注意,此函数仅在 POSIX 系统中有实际区别。在 Windows 中,是 fsync()
的别名。
示例 #1 fdatasync() 示例
<?php
$file = 'test.txt';
$stream = fopen($file, 'w');
fwrite($stream, 'test data');
fwrite($stream, "\r\n");
fwrite($stream, 'additional data');
fdatasync($stream);
fclose($stream);
?>
Does not flush st_atime, st_mtime or st_size.
If you need to use filesize after a write you will need need fsync() or fflush() instead.