PHP换行符在文本文件中不起作用 [英] PHP newline not working in text file

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

问题描述

我正在使用PHP代码:

I am using the PHP code:

$numberNewline = $number . '\n';
fwrite($file, $numberNewline);

将$ number写入文件.

to write $number to a file.

由于某些原因,\ n出现在文件中.我在Mac上.可能是什么问题?

For some reason \n appears in the file. I am on a mac. What might be the problem?

推荐答案

$numberNewline = $number . "\n";
fwrite($file, $numberNewline);

尝试一下

这篇关于PHP换行符在文本文件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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