无法将XML数据显示为HTML

时间:2014-10-23 12:44:21

标签: php html xml

我从url

加载了一个xml文件
$xml = simplexml_load_file($xml_url);

但是当我用php回声时,我的浏览器无法读取XML中的HTML标记。

echo $child->description;

显示如下内容。

<p> The secadition.</p> <p> Time isbt. <em>As offignity.</em></p>

无论如何要让浏览器读取HTML标签?

在XML

    <description>
&lt;p&gt;
 The secret of our success is very simple - we respect our clients, provide them only with the high quality commodities and work only with the best and the most reliable suppliers. What we offer is not just the reliable mechanisms, we offer stylish and desired watches that will present you as the owners of prestigious tradition.&lt;/p&gt;
 &lt;p&gt;
 Time is priceless, without a doubt. &lt;em&gt;As official time providers we will help you appreciate your time and with our watches you will do that with style and dignity.&lt;/em&gt;&lt;/p&gt;
</description>

更新

html_entity_decode() will solve this problem

1 个答案:

答案 0 :(得分:0)

您可能需要取消转义html实体