[英]CKEditor is escaping html elements
I am using CKEditor to insert text into a MySQL database. 我正在使用CKEditor将文本插入MySQL数据库。 I have noticed that my installed CKEditor is escaping all HTML elements when the data reaches the database. 我注意到,当数据到达数据库时,我安装的CKEditor正在转义所有HTML元素。
Therefore the following is what I am getting in the database after I have inserted the text with CKEditor: 因此,在使用CKEditor插入文本后,我将在数据库中获取以下内容:
'&' (ampersand) becomes '&'
'"' (double quote) becomes '"
"'" (single quote) becomes ''
'<' (less than) becomes '<'
'>' (greater than) becomes '>'
I would rather disable the CKEditor HTML escaping completely, and rely on my PHP script to handle the HTML escaping using PHP's htmlspecialchars
. 我宁愿完全禁用CKEditor HTML转义,并依靠我的PHP脚本来处理使用PHP的htmlspecialchars
的HTML转义。
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. 我禁用CKEditor的HTML转义能力的另一个好理由是我想保留MySQL数据库中的书面内容。 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. 换句话说,我想在数据库中保留单引号和双引号,然后当我使用MySQL select语句将数据库数据打印到页面时,我想让PHP使用htmlspecialchars
清理HTML元素。
Can anybody tell me how to disable html escaping within CKeditor? 任何人都可以告诉我如何在CKeditor中禁用html转义? Your input or any advice on the above would be much appreciated. 您的意见或建议将非常感谢。
Here you go: 干得好:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.