向从SQL提取的文本添加换行符


Adding Linebreaks to text pulled from SQL

当我从MySQL数据库获取数据并使用PHP查看HTML源时,显示如下

<div class="Desc">testing lines
new line
another                     </div>

我如何让它在行尾添加,以便在浏览器中正确显示

我想以这样的结尾

<div class="Desc">testing lines<br/>
new line<br/>
another line<br/>                       </div>

我试过<?PHP echo nl2br($text) ?>但这行不通

是的,你是正确的-它确实有效,我正在查看源代码或添加nl2br代码后的错误页面

我的错

谢谢