我正面临着PHP文件I/O的问题.
$file = fopen("/tmp/test.txt", "w");
fwrite($file,"hi there\n");
fclose($file);
echo filesize("/tmp/test.txt")."\n"; # displays 9
$file = fopen("/tmp/test.txt", "a");
fwrite($file,"hi there\n");
fclose($file);
echo filesize("/tmp/test.txt")."\n"; # also displays 9 !!!!!!!
Run Code Online (Sandbox Code Playgroud)
可以看到,我在初始写入后通过附加更改文件大小.在这两种情况下,为什么我的文件大小为9?我期待在案例2中输出18作为输出.