HTML标记不被渲染 [英] HTML tags not being rendered

查看:236
本文介绍了HTML标记不被渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我在TinyMCE(或CKEditor,无所谓)中格式化文本时,以及将它保存在我的数据库中一切正常。但是,当我将文本打印回来时,令人惊讶的是,我的浏览器不会呈现html标签并将它们显示为纯文本!



我已经检查过,并且在页面中没有任何一种 CDATA ,这可能会导致问题。



以下是它的呈现方式:



然而,当用FireBug检查问题时,我注意到<$ $之前有很多空格正在打印c $ c>< h2> 标签!如果我只是对空格进行一些改动(删除一个或添加另一个),那么浏览器将显示标签并正确显示文本!!



你们可以吗?帮我解决这个问题?这真的很奇怪。当你将数据保存到数据库时,出于某些安全原因进行编码,
$ b

html_entity_decode(string retrived from database);



和然后打印它。


I'm building a simple blog system with FuelPHP and TinyMCE editor.

When I format my text in the TinyMCE (or CKEditor, doesn't matter) and save it in my database everything is OK. However when I print the text back, surprisingly, my browser won't render the html tags and displays them as plain text!

I have checked and I don't have any kind of CDATA in the page, that might cause the issue.

Here is how it renders:

However, when inspecting the issue with FireBug, I noticed a lot of spaces before the <h2> tag is being printed! If I just make a small change in the spaces (Remove one or add another), then the browser will render the tags and display the text properly!!

Can you guys help me with this issue? It's really weird.

解决方案

when you save your data in database its encoded for some security reasons you just need to

html_entity_decode("string retrived from database");

and then print it.

这篇关于HTML标记不被渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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