当我将带有换行符的文本插入 sqlite2 db时,所有换行符都显示为
。
我可以用
删除它们$content = html_entity_decode($row['Content']);
但是如何将它们转换为<br/>
?
到目前为止我已经尝试了
$content = str_replace(" ",'<br/>',$row['Content']);
$content = preg_replace("/\&\#10\;/", "<br/>", $row['Content']);
$content = str_replace("\x0a", "<br/>", $row['Content']);
$content = str_replace(' ','<br/>',$row['Content']);
$content = str_replace(" ","<br/>",$row['Content']);
没有运气。
仍然存在,因为它没有这些线。
下一步是什么?
答案 0 :(得分:2)
尝试
$content = nl2br(html_entity_decode($row['Content']));