nl2br()定义和用法

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

语法

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

例子

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

输出:

One line.
Another line.

HTML 代码:

One line.<br />
Another line.

相关文章:

  • 2021-04-07
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2023-04-03
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-12-05
  • 2021-08-06
相关资源
相似解决方案