How is a+(read/append) different from a(append) in php

孤街醉人 提交于 2019-11-28 11:31:53

问题


I am reading(and slowly trying) the ways to interact with a txt file in php. I have already tried append and it adds data to the end of the txt file But how is a+ different from a

In w3schools it says:

a Append. Opens and writes to the end of the file or creates a new file if it doesn't exist

a+ Read/Append. Preserves file content by writing to the end of the file

What does a+ do differently and what does it actually "Preserve"


回答1:


With a you can just append to the end of the file.

With a+ you can read the file too, so you can move the file pointer using fseek and add content somewhere else inside the file.



来源:https://stackoverflow.com/questions/18057322/how-is-aread-append-different-from-aappend-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!