小编use*_*837的帖子

附加后PHP文件大小不变

我正面临着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作为输出.

php file-io caching filesize

8
推荐指数
1
解决办法
530
查看次数

标签 统计

caching ×1

file-io ×1

filesize ×1

php ×1