HtmlPurifier - 允许名称属性

HtmlPurifier - allow name attribute

如何在 HtmlPurifier 中允许 'name'? 我尝试这样使用:

config = HTMLPurifier_Config::createDefault();
$config->set('HTML.AllowedAttributes', 'img._src, img.name, img.src,img.alt');
return HtmlPurifier::process($html, $config);

但它不起作用?我能怎么做?谢谢

查看此配置选项:http://htmlpurifier.org/live/configdoc/plain.html#HTML.Attr.Name.UseCDATA

The W3C specification DTD defines the name attribute to be CDATA, not ID, due to limitations of DTD. In certain documents, this relaxed behavior is desired, whether it is to specify duplicate names, or to specify names that would be illegal IDs (for example, names that begin with a digit.) Set this configuration directive to true to use the relaxed parsing rules.