Zend framework2 包括带有Zend Framework 2的HTMLPurifier
我正在尝试将htmlpurifier与zend framework 2集成。 根据zf2用户指南(http://framework.zend.com/manual/2.0/en/modules/zend.feed.security.html)我改变了这样一个模型: 在顶部,我得到:Zend framework2 包括带有Zend Framework 2的HTMLPurifier,zend-framework2,htmlpurifier,Zend Framework2,Htmlpurifier,我正在尝试将htmlpurifier与zend framework 2集成。 根据zf2用户指南(http://framework.zend.com/manual/2.0/en/modules/zend.feed.security.html)我改变了这样一个模型: 在顶部,我得到: require_once '/Purifier/HTMLPurifier.auto.php'; 在该函数中: ... $options = array(
require_once '/Purifier/HTMLPurifier.auto.php';
在该函数中:
...
$options = array(
array(
'HTML.Allowed',
'p,a[href]'
),
array(
'Output.TidyFormat',
true
),
array(
'HTML.Doctype',
'XHTML 1.0 Strict'
),
array(
'Cache.DefinitionImpl',
null
)
);
$config = HTMLPurifier_Config::createDefault();
foreach ($options as $option) {
$config->set($option[0], $option[1]);
}
$purifier = new HTMLPurifier($config);
$text = $purifier->purify($this->getPosttext());
...
我将htmlpurifiers“library”文件夹复制到
“src/应用程序/型号/净化器”
自动文件位于:
“src/Application/Model/purizer/HTMLPurifier.auto.php”
模型文件位于中
“src/应用程序/模型”
但我还是犯了这个错误:
致命错误:在第76行的…path…\module\Application\src\Application\Model\Post.php中找不到类“Application\Model\HTMLPurifier\u Config”
如何正确地包含htmlpurifier?类中有名称空间,请使用
\HTMLPurifier_Config::createDefault();
new \HTMLPurifier();
求你了。您最好先了解一下。用作表单内部的ZF2筛选器