I'm using CKEDITOR 4 for my own website. recently, I noticed when I am editing my post, if there are HTML codes, it just prints as HTML. If the code was:
<code language-html ...>
<h1>Helloworld</h1>
<p>This is the post!</p>
</code>
But the result is really weird:
only I can imagine is CKEDITOR read the HTML code, and parse it. I removed CKEDITOR to normal "textarea" tag, and there was no problem (code tag contains h1, p).
I searched on the Google and find some solutions, but nothing worked to me. Most I found was set the config above:
config.entities = false;
config.basicEntities = false;
config.entities_greek = false;
config.entities_latin = false;
config.entities_additional = '';
config.htmlEncodeOutput = false;
Still not working. Can anyone know about this issue?
p.s. I am using express framework as the server, and using jade template engine. I escaped the content when print: textarea#txtLog (name='log')!{log.text}
答案 0 :(得分:0)
使用
htmlspecialchars($your_content, ENT_QUOTES, "UTF-8")
从数据库中提取帖子内容后显示帖子内容。