使用php附加到文本文件的下一行 [英] Append to next line in text file using php

查看:26
本文介绍了使用php附加到文本文件的下一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将值传递给 .txt 文件的 php 脚本,没有问题并且可以正常工作,唯一的问题是我想将该值附加到下一行,而不是一个接一个地附加该值value 所以我想要的不是valuevalue":

I have a php script which passes a value to a .txt file, there is no problem and it works, the only thing is I would like to append the value to the next line instead of just append the value right after another value so instead of "valuevalue" I would like:

价值

价值

我的脚本:

$filename4 = "EmailsFromSignUp.txt";
$content = file_get_contents($filename4);
$content .= $emailFPay;
file_put_contents($filename4, $content);

推荐答案

尝试

$content .= PHP_EOL . $emailFPay;

这篇关于使用php附加到文本文件的下一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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