Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用file_put_contents写入文件,我得到重复的内容......写 2x 和 1x litura
file_put_contents
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/test/test.tmp', '1 ', FILE_APPEND);
test.tmp 的内容
11
已经重新启动了 apache,我直接访问而不使用 htaccess。
您file_put_contents在附加模式下使用,因此每次运行脚本时都会附加 1。使用没有第三个参数的代码。
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/test/test.tmp', '1 ');
现在test.tmp文件的输出将始终为 1。
test.tmp