CKEditor是转义html元素 [英] CKEditor is escaping html elements

查看:1173
本文介绍了CKEditor是转义html元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CKEditor将文本插入MySQL数据库。我注意到,我安装的CKEditor是在数据到达数据库时转义所有的HTML元素。



因此,下面是我在插入数据库后得到的数据。使用CKEditor的文本:

 '&'(和号)变为'& amp;'

'''(双引号)变成'& quot;

'(单引号)变成''

'<' )成为'& lt;'

'>'(大于)变为'& gt;'

我宁愿禁用CKEditor的HTML转义完全,依靠我的PHP脚本处理HTML转义使用PHP的 htmlspecialchars

另一个很好的原因,我禁用CKEditor的HTML转义功能是我想保留MySQL数据库中的书面内容。换句话说,我想保留单引号和双数据库中的引号,然后我想让PHP使用 htmlspecialchars 清理HTML元素,当我使用MySQL选择语句打印数据库数据到页面。



任何人都可以告诉我如何在CKeditor中禁用html转义?

解决方案

到此为止:




I am using CKEditor to insert text into a MySQL database. I have noticed that my installed CKEditor is escaping all HTML elements when the data reaches the database.

Therefore the following is what I am getting in the database after I have inserted the text with CKEditor:

'&' (ampersand) becomes '&amp;'

'"' (double quote) becomes '&quot;

"'" (single quote) becomes '&#039;

'<' (less than) becomes '&lt;' 

'>' (greater than) becomes '&gt;' 

I would rather disable the CKEditor HTML escaping completely, and rely on my PHP script to handle the HTML escaping using PHP's htmlspecialchars.

Another good reason for me to disable CKEditor's HTML escaping ability is that I want to preserve the written content in the MySQL database. In other words I want to keep the single quotes and double quotes in the database, and then I want to have PHP sanitise the HTML elements with htmlspecialchars when I print the database data to page using MySQL select statement.

Can anybody tell me how to disable html escaping within CKeditor? Your input or any advice on the above would be much appreciated.

解决方案

Here you go:

这篇关于CKEditor是转义html元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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