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

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

问题描述

我正在阅读(并慢慢尝试)与 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 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

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.

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

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