用 HTML 内容清理 POST 内容

Sanitize POST content with HTML contents

我想通过 POST 发送 HTML 内容。 但是当获取它并对其进行清理时,它也会清除 HTML 个字符。

$Code = filter_var_array($value, FILTER_SANITIZE_STRING);

当我发送时:

I would like to <strong>Save this data</strong>

我收到:

I would like to Save this data

我应该更改什么以创建安全字符串?

编辑: 在我的表单中,我有一个 WYSIWYG 编辑器(FCK 编辑器),它的内容就是我所追求的。

我使用了 HTMLPurifier 这是一个 PHP 过滤器库来清理 HTML 输入。

基本用法是这样的;

include_once('/htmlpurifier/library/HTMLpurifier.auto.php');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean['htmlData'] = $purifier->purify($_POST['htmlData']);