允许使用 HTMLPurifier 嵌入/对象/参数 HTML 标签吗?
是否可以使用 HTMLPurifier 允许嵌入、对象和参数 HTML 标签?我试图允许嵌入 YouTube、Vimeo 等视频,但无论我如何尝试,它们总是被删除。我确实知道允许使用这些标签是有风险的。
如果不可能,PHP 还有哪些其他 HTML 过滤选项? Tidy 似乎不是为过滤而设计的……是吗?而且 strip_tags() 没有给我我正在寻找的控制级别 - 例如只允许某些属性。
感谢您的帮助!
Is it possible to allow embed, object, and param HTML tags with HTMLPurifier? I'm trying to allow YouTube, Vimeo, etc. videos to be embedded, but they're always stripped, no matter what I try. I do understand that these are risky tags to allow.
If it's not possible, what other HTML filtering options do I have with PHP? It doesn't seem that Tidy is designed for filtering... is it? And strip_tags() doesn't give me the level of control — such as only allowing certain attributes — that I'm looking for.
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于较新版本 (4.1+),
Filter.YouTube
已弃用。因此,您应该使用
HTML.SafeObject
&Output.FlashCompat
但 htmlpurifier 仍然有正确解释 youtube & 的一些问题ETC。
他们的工作地址: http://htmlpurifier.org/phorum/ read.php?5,2239,page=3 所以可能在未来几个月应该最终完成。
For newer versions (4.1+)
Filter.YouTube
is deprecated.So instead you should use
HTML.SafeObject
&Output.FlashCompat
but htmlpurifier still have some problems with proper interpretation of youtube & etc.
they work on it at: http://htmlpurifier.org/phorum/read.php?5,2239,page=3 so probably in future months it should be finally done.
您拥有的最佳解决方案是 http://htmlpurifier.org/docs/enduser-youtube.html< /a>
The best solution you have is http://htmlpurifier.org/docs/enduser-youtube.html