php将文本显示为存储在数据库中的html格式

air*_*air 0 html php

我在MySQL数据库中保存了一个文本

<p> Celebrate with these amazing<br /> offers direct from the  
Run Code Online (Sandbox Code Playgroud)

现在,当我使用打印该文本时

echo 
Run Code Online (Sandbox Code Playgroud)

我得到了这个输出

 <p> Celebrate with these amazing<br /> offers direct from the  
Run Code Online (Sandbox Code Playgroud)

但你想把它显示为

Celebrate with these amazing
 offers direct from the  
Run Code Online (Sandbox Code Playgroud)

喜欢HTML打印.

当我在db中看到它的存储时就像波纹管一样

&lt;p&gt;
    Celebrate with these amazing&lt;br /&gt;
    offers from
Run Code Online (Sandbox Code Playgroud)

这该怎么做?

Nic*_*ick 7

假设您的数据库已保存转义信息,如下所示:

&lt;p&gt;
    Celebrate with these amazing&lt;br /&gt;
    offers from
Run Code Online (Sandbox Code Playgroud)

然后你可以使用PHP的html_entity_decode函数输出那个HTML块.