如何使文本出现在 html 的差异行上?!当从 mysql 输出时,它们出现在我的文本区域的差异行上,也出现在 mysql 内的差异行上。但在网页中,它全部集中在一条线上。如何解决?

如何使文本出现在 html 的差异行上?!当从 mysql 输出时,它们出现在我的文本区域的差异行上,也出现在 mysql 内的差异行上。但在网页中,它全部集中在一条线上。如何解决?

采用:
string nl2br ( string $string [, bool $is_xhtml = true ] )
它可以处理\n, \r,\r\n或\n\r换行符并将它们替换为<br />
例子:
$yourText = "This is line one.\nThis is line two.";
$yourText = nl2br($yourText);
echo $yourText;
这将导致:
This is line one.<br />This is line two.
替换Linebreaks为<br>
str_replace(.N, '<br>', [element]);
您可以<pre>..Your text..</pre>为此使用标签。