file_put_contents和换行帮助 [英] file_put_contents and a new line help

查看:163
本文介绍了file_put_contents和换行帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要写入的文件,即使在换行符之后,也无法获取file_put_contents将下一个条目追加到新行上.我想念什么?我在Windows机器上.

I've got a file that I'm writing to and I cannot get file_put_contents to append the next entry on a new line, even after a newline character. What am I missing? I'm on a windows machine.

$file = 'test.txt';
$message = "test\n\n";
file_put_contents($file, $message, FILE_APPEND);

推荐答案

您如何查看$file的内容?如果您使用的是记事本,则看不到\n.

how are you viewing the contents of $file? if you're using notepad you can't see \n.

这篇关于file_put_contents和换行帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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