0
하이퍼 링크를 사용하지 않도록 설정하고 HTMLPurifier를 사용하여 일반 텍스트로 표시하려고하지만 올바르게 표시하지 않았습니다. 여기 내 코드는 다음과 같습니다하이퍼 링크를 사용하지 않도록 HTMLPurifier를 구성하는 방법
$html ='<a href="http://www.localhost.com/">link</a><b>test</b>';
require_once 'include/htmlpurifier/library/HTMLPurifier.auto.php';
$Config = HTMLPurifier_Config::createDefault();
$Config->set('AutoFormat.DisplayLinkURI', true);
$purifier = new HTMLPurifier();
$html = $purifier->purify($html);
echo $html;
전류 출력은 다음과 같습니다
<a href="http://www.localhost.com/">link</a><b>test</b>
문제가 무엇입니까? 당신이 HTML 정수기 생성자로 설정 객체를 전달하지 않는, 그래서 그것은 작동하지 않습니다
<a>link</a> (http://www.localhost.com/)<b>test</b>