PHP回显等效于记事本的CR LF [英] PHP echo the equivalent of CR LF of Notepad
问题描述
我需要使用PHP导出一些数据,并为每行添加一个 \ r \ n
.当我打开下载的导出数据文件时,看到 \ r \ n
在记事本中被解释为[LF].
I need to export some data using PHP and for each line I'm adding a \r\n
. When I open the exported data file that I downloaded, I see that the \r\n
is interpreted as [LF] in Notepad.
但是打开文件的应用程序未将[LF]读为新行.
But the application in which I open the file doesn't read the [LF] as a new line.
现在,如果我在记事本中执行[CR] [LF],则应用程序可以将[CR] [LF]换行.
Now if I do a [CR][LF] in Notepad, the application can read the [CR][LF] as a new line.
如何用PHP回显[CR] [LF]的等价物?
How can I echo the equivalent of [CR][LF] with PHP?
推荐答案
问题已解决:字符串在POST参数中传递.删除\ r.
Problem solved: the string was passed in the POST parameter. Removing the \r.
您只需要执行 str_replace("\ n","\ r \ n",$ ...);
.
这篇关于PHP回显等效于记事本的CR LF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!