HTML Purifier编码帮助?

时间:2010-03-31 10:04:02

标签: php mysql htmlpurifier

我阅读了http://htmlpurifier.org/docs/enduser-youtube.html文档,但我仍然无法弄清楚在哪里放置代码以允许对象,参数和嵌入标记以及Use experimental features与我的htmlpurifier一起使用。有人可以告诉我该怎么做吗?

2 个答案:

答案 0 :(得分:3)

添加此内容。

 $config->set('HTML.SafeObject', true);
 $config->set('HTML.SafeEmbed', true);

对此。

 require_once '../../htmlpurifier/library/HTMLPurifier.auto.php';

 $config = HTMLPurifier_Config::createDefault();
 $config->set('Core.Encoding', 'UTF-8'); // replace with your encoding
 $config->set('HTML.Doctype', 'XHTML 1.0 Strict'); // replace with your doctype
 $config->set('HTML.SafeObject', true);
 $config->set('HTML.SafeEmbed', true);
 $purifier = new HTMLPurifier($config);

 $about_me = mysqli_real_escape_string($mysqli, $purifier->purify($_POST['about_me']));

答案 1 :(得分:0)

HTML.SafeObject占用了大量内存我不推荐你:

http://support.chamilo.org/issues/1450