Php 将html实体转换为html文本

Php 将html实体转换为html文本,php,html,html-entities,Php,Html,Html Entities,我有这个字符串: &amp;lt;p&amp;gt;This is a test&amp;lt;/p&amp;gt;rn&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;this is a test&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt; 所以我尝试将原始字符串转换为HTML 我试过: echo ' <h4><b

我有这个字符串:

&amp;lt;p&amp;gt;This is a test&amp;lt;/p&amp;gt;rn&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;this is a test&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;
所以我尝试将原始字符串转换为HTML

我试过:

echo ' <h4><b>Din besvarelse</b></h4> 
<text style="word-wrap: break-word; height:auto;">
'.htmlspecialchars_decode($progressinfo['comment']).'</text>';
我希望它是这样的:

<p>This is a test</p>rn<p><strong>this is a test</strong></p>
这是一个测试

rn这是一个测试

那么,如何将包含HTML实体的字符串转换为原始HTML,以在HTML中呈现呢


谢谢;lt是一个双重编码的元素。使用
htmlspecialchars\u解码
一次就可以将其解码到
,因为
&转换为
&
。然后浏览器将其呈现为“在我的末端工作”:。或者我遗漏了什么?我看不出“它打印出原始html”[]和您显示的“希望它像这样”之间有什么区别。我看不出有什么不同,伙计。@chris85这就是我得到的:我希望HTML也能工作,而不仅仅是打印出来out@anant我希望HTML也能工作。。见评论above@chris85非常感谢你!我尝试过很多解决办法。你让我开心
<p>This is a test</p>rn<p><strong>this is a test</strong></p>
echo htmlspecialchars_decode(htmlspecialchars_decode('&amp;lt;p&amp;gt;This is a test&amp;lt;/p&amp;gt;rn&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;this is a test&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;'));