php中的a +(读取/附加)与a(附加)有何不同 [英] How is a+(read/append) different from a(append) in php

查看:93
本文介绍了php中的a +(读取/附加)与a(附加)有何不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读(并慢慢尝试)与php中的txt文件进行交互的方式。
我已经尝试过追加,它会将数据添加到txt文件的末尾
但是a +与a

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

有什么不同?在w3schools中,它说:

In w3schools it says:

a
追加。打开并写入文件末尾;如果文件不存在,则创建一个新文件

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

a +
读取/追加。通过写入文件末尾来保留文件内容

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

a +的不同之处以及实际上保留的作用

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

推荐答案

使用 a ,您可以将其追加到文件末尾。

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

使用 a + 也可以读取文件,因此可以使用 fseek 移动文件指针,然后在文件内的其他位置添加内容。

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.

这篇关于php中的a +(读取/附加)与a(附加)有何不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆