我在cakephp v1.3应用程序中使用wmd-editor。显示HTML内容
这是我写的配置如下:
wmd_options = {
output: "HTML",
lineLength: 40,
buttons: "bold italic | link blockquote code image | ol ul heading hr",
autostart: true
};
当我提交表单的大规模杀伤性武器启用textarea的保存与htmlentities()
数据库做那么文本就被解码与html_entity_decode()
的HTML方法自动。
但因为它是包括HTML编码这样
<p><strong>hello dear friends</strong></p>\n\n<pre><code>I want to make sure that everything that you type is visible clearly.\nadasfafas\n</code></pre>\n\n<blockquote>\n <p>sadgsagasdgxcbxcbxc</p>\n</blockquote>\n\n<p><em>sadfgsgasdsgasgs</em></p>\n\n<p><b><a href="http://kumu.in">this is the link</a></b></p>
显示文本请帮我解决这个问题
感谢
您是否尝试过不使用'htmlentities()'和'html_entity_decode()'?听起来像输入可能已经被编码(即'>'变成'& gt;'然后在你的页面上显示'<'而不是在源文件中)。 – deizel 2010-05-25 11:13:12
是啊,你是对的......我已经想出了......但现在面临一个不同的问题。 :-((将解码后的文本填充到wmd-input中,这样所有的格式都将保留并可供最终用户看到) 实际上,我使用的是Sanitize :: clean方法的蛋糕php清理类 这会自动将htmlentities将数据发布到数据库 – 2010-05-25 12:01:36