在Zend Framework中剥离HTML标记

4 php zend-framework

我试图<p>,<br>,<strong>,<b>从以下输入数据中删除所有html标记:

    public function init()
{
    parent::init();
    $this->fields = array(
        'name' => 'Name',
        'age' => 'Age',
        'profile' => 'Profile',
    );

    $this->mdata = array();
    $this->verify = true;
}
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何在其中应用Zend_Filter_StripTags?

Nav*_*eed 8

如果我理解你的问题:

$allowedTags = array('p','b','br','strong'); // Allowed tags
$allowedAttributes = array('href'); // Allowed attributes
$stripTags = new Zend_Filter_StripTags($allowedTags,$allowedAttributes); // instance of zend filter
$sanitizedInput = $stripTags->filter($input); //$input is input html
Run Code Online (Sandbox Code Playgroud)

看到这个答案