Javascript 富文本编辑器和关联类来过滤和清理输入?
我意识到有几个适用于 jQuery 的富文本编辑器,但我找不到任何具有关联类的关联类,该类可以执行接受数据库输入所需的过滤和清理。
存在这样的类吗?
我对 PHP 库特别感兴趣,但 .NET 也会很有趣。
I realise there are several rich text editors for jQuery but I cannot find any that have an associated class that does the filtering and cleaning required to accept the input into a database.
Does such a class exist?
I am particularly interested for a PHP library, but .NET would be interesting too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 FCKeditor,它将允许您获得干净的 HTML 或 XHTML (editor.GetXHTML()),然后您可以将其写入数据库。
实际上,您写入数据库的内容并不那么重要,因为通常您编写的是原始 HTML(如果需要,您可以随时从中删除明智的标签)。 为了防止 XSS 攻击,在网页上显示内容之前对其进行正确编码至关重要。 对于 .NET,CodePlex.com 上有 AntiXSS 库
对于 PHP,您可能需要查看以下库:
还有这篇文章:
If you would use FCKeditor it would allow to you get clean HTML or XHTML (editor.GetXHTML()) which you could then write into DB.
Actually it's not that much important what you write into DB, because usially you write original HTML (you can always strip from it saspicious tags if needed). In order to prevent XSS attacks it is essential to properly encode content before displaying it on the web-page. For .NET there is AntiXSS library for that at CodePlex.com
For PHP you may want to look at the following libraries:
And also this article: