如何转换  从sqlite2到<br/>?

时间:2013-05-31 06:12:02

标签: php sqlite

当我将带有换行符的文本插入 sqlite2 db时,所有换行符都显示为&#10;

我可以用

删除它们
$content = html_entity_decode($row['Content']);

但是如何将它们转换为<br/>

到目前为止我已经尝试了

$content = str_replace("&#10;",'<br/>',$row['Content']);

$content = preg_replace("/\&\#10\;/", "<br/>", $row['Content']);

$content = str_replace("\x0a", "<br/>", $row['Content']);

$content = str_replace('&#10;','<br/>',$row['Content']);

$content = str_replace("&#10;","<br/>",$row['Content']);
没有运气。 &#10;仍然存在,因为它没有这些线。

下一步是什么?

1 个答案:

答案 0 :(得分:2)

尝试

$content = nl2br(html_entity_decode($row['Content']));