定义和用法

nl2br() 函数在字符串中的每个新行 (\n) 之前插入 HTML 换行符 (<br />)。

语法

nl2br(string)
参数 描述
string 必需。规定要检查的字符串。

例子

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

输出:

One line.
Another line.

HTML 代码:

One line.<br />
Another line.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-11-28
猜你喜欢
  • 2021-12-13
  • 2021-10-27
  • 2021-09-05
  • 2022-02-18
  • 2021-08-14
  • 2021-11-28
  • 2021-12-24
相关资源
相似解决方案