PHP的回声工作的HTML代码从MySQL? [英] php echo working html code from mysql?

查看:115
本文介绍了PHP的回声工作的HTML代码从MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储在mysql数据库字段中的html代码块。如果我试着回显它,它只是作为文本坐在页面上。有没有办法以工作的方式回应它。 (意思是html显示它的意思)

I have a chunk of html code stored in a field in a mysql database. If i try and echo it out it just sits on the page as text. Is there a way to echo it out in a working fashion. ( Meaning the html displays what it is meant to display )

代码存储在varchar字段中,我使用带有特殊字符的nl2br来插入它。代码显示为文本,但应该是它。

The code is stored in a varchar field and i used nl2br with special characters to insert it. The code display's as text but it is what it should be.

我可以再次以一种工作方式回应代码吗?

Again can i echo the code out in a working way?

编辑 - 这是显示在页面上的代码。

EDIT - This is the code that is displayed on the page.

<img name="" src="http://www.mysite.com/assets/viewcart.png" width="114" height="48"alt="" />

并且这是代码存储在数据库中。

and this is the code stored in the database.

&lt;img name=&quot;&quot; src=&quot;http://www.mysite.com/assets/viewcart.png&quot; width=&quot;114&quot; height=&quot;48&quot; alt=&quot;&quot; /&gt;

我用来获取代码的Echo请求很简单。

The Echo request i used to get the code out was a simple.

echo $row['htmlcode'];

感谢您提供任何帮助和示例。

Thanks for any help and examples.

推荐答案

您可以尝试通过 echo 之前

echo html_entity_decode($ row ['htmlcode']);

这篇关于PHP的回声工作的HTML代码从MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆