连接字符串时换行符不起作用


Line break not working when concatenating strings

我在谷歌上搜索了很多关于这个问题的信息,但没有看到任何可以帮助我的答案。例如,我有下一行代码:

$row ['technischgereed'] =  "The quotation is not technically completed 'n" . $separatedArray ; 
$row ['technischgereed'] =  "The quotation is not technically completed 'r'n" . $separatedArray ;
$row ['technischgereed'] =  "The quotation is not technically completed <br/>" . $separatedArray ;
$row ['technischgereed'] =  "The quotation is not technically completed". "'n(or <br> or 'r'n)" . $separatedArray ;

所以我想有如下的东西

The quotation is not technically completed
Planned:Kitchen
In execution:Bedroom
Done:Basement 

取而代之的是,我在同一行中得到所有内容。有什么建议吗?

使用 nl2br($row['technischgereed']),它将/n 更改为 <br />

除此之外,我认为您应该将 .= 用于下一条消息,我只看到等号,这意味着每个新的等号都会覆盖上一条而不是添加到它。

' 在源中仅作为换行符可见。代替使用<br />,或者在回显$row ['technischgereed']时使用nl2br()将换行符转换为<br />