我正在使用file_put_contents
写入文件而我正在获取重复的内容...写入2x和1x litura
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/test/test.tmp', '1 ', FILE_APPEND);
test.tmp的内容
11
已经重新启动了apache,我在没有htaccess的情况下直接访问。
答案 0 :(得分:1)
您在附加模式下使用file_put_contents
,因此每次运行脚本时都会附加1。使用不带第3个参数的代码。
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/test/test.tmp', '1 ');
现在test.tmp
文件的输出将始终为1.