【问题标题】:html purifier - allow links?html 净化器 - 允许链接?
【发布时间】:2012-08-18 03:59:33
【问题描述】:

链接和 html 净化器的老问题。 我正在使用此代码:

$config = HTMLPurifier_Config::createDefault();  
$config->set('HTML.Allowed', 'p,b,a[href],i');  
$config->set('HTML.AllowedAttributes', 'a.href');  
$purifier = new HTMLPurifier($config);

但它不起作用。 输入

<a href="http://www.google.de">search</a>

将转为

<a href="%5C">search</a>

有什么想法吗?

【问题讨论】:

    标签: html htmlpurifier


    【解决方案1】:

    【讨论】:

    • 谢谢!这做到了!
    • 请点击答案旁边的“复选框”接受它,谢谢!
    • 不错的答案。注意(对于可能使用此解决方案的人):在某些共享托管服务器中,您可能无法禁用 magic_quotes
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 2021-02-09
    相关资源
    最近更新 更多