HTMLPurifier를 만드는 데 문제가 있습니다. 태그 속성을 필터링하지 않지만 지금까지 성공하지 못하고 있습니다.HTMLPurifier에서 속성 허용
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', 'UTF-8');
$config->set('Core.CollectErrors', true);
$config->set('HTML.TidyLevel', 'medium');
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
$config->set('URI.DisableExternalResources', false);
$config->set('HTML.Allowed', 'table[border|width|style],tbody,tr,td,th,img[style|src|alt],span[style],p[style],ul,ol,li,strong,em,sup,sub');
$PHTML = new HTMLPurifier($config);
echo htmlspecialchars($PHTML->purify($html));
// The input string:
"Some <span style="text-decoration: underline;">cool text</span> <img src="http://someurl.com/images/logo.png" alt="" />.
// The output string:
"Some <span>cool text</span> <img src="%5C" alt="" />.
HTML.Allowed 옵션에 정의 된 지정된 요소에 대해 지정된 속성을 허용하려고합니다.
시도해 보았지만 이제는 출력 중입니다. 일부 멋진 텍스트 – kanevbgbe
여전히 마술 따옴표가 나와 있습니다 ... –