还是 nl2br()?
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我想到它时,为什么我应该使用函数 nl2br() 而不是使用标签<pre></pre>?
<pre></pre>
谢谢。
这取决于您和您想要的输出。没有Should也不<pre>只是针对新线路,nl2br()仅限于此。
Should
<pre>
nl2br()
pre 元素表示一个预先格式化的文本块,其中结构由排版约定而不是元素来表示。
资源
nl2br — 在字符串中的所有换行符之前插入 HTML 换行符
自己发现并优先考虑差异:)