插件窝 干货文章 PHP nl2br() 函数

PHP nl2br() 函数

php nl2br nl2br() 650    来源:插件窝    2020-03-29

在字符串中的新行(\n)之前插入换行符:


<?php
echo nl2br("One line.\nAnother line.");
?>

以上代码的浏览器输出:


One line.

Another line.

以上代码的 HTML 输入(查看源代码):


One line.<br />
Another line.