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

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

问题描述

我有一个PHP脚本传递一个值到一个.txt文件,是没有问题的,它的工作原理,唯一的事情是我想的价值附加到下一行,而不是又一个仅仅附加价值权价值因此而不是valuevalue我想:

我的脚本:

  $ filename4 =EmailsFromSignUp.txt;
$内容=的file_get_contents($ filename4);
$内容= $ emailFPay。
的file_put_contents($ filename4,$内容);


解决方案

尝试

  $内容= PHP_EOL。 $ emailFPay;

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:

value

value

My script:

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

解决方案

Try

$content .= PHP_EOL . $emailFPay;

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

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