nl2br() 函数在字符串中的每个新行 (\n) 之前插入 HTML 换行符 (<br />)。经常用于在线编辑的内容,以便显示。
用法:nl2br(string)
<?php echo nl2br("One line.\nAnother line."); ?>
nl2br("One line.\nAnother line.")
输出:
One line. Another line.