Php 如何在Zend_表单装饰器中设置元素的文本

Php 如何在Zend_表单装饰器中设置元素的文本,php,zend-framework,zend-form,zend-decorators,Php,Zend Framework,Zend Form,Zend Decorators,我试图在以下代码中设置lengend标记内的文本: $element->setDecorators(array( 'ViewHelper', 'Description', 'Errors', array(array('legend' => 'HtmlTag'), array('tag' => 'legend', 'placement' => 'prepend')), array(arr

我试图在以下代码中设置lengend标记内的文本:

    $element->setDecorators(array(
        'ViewHelper',
        'Description',
        'Errors',
        array(array('legend' => 'HtmlTag'), array('tag' => 'legend', 'placement' => 'prepend')),
        array(array('fieldset' => 'HtmlTag'), array('tag' => 'fieldset')),
    ));
生成以下内容:

    <fieldset>
    <legend></legend>
    </fieldset>

您可以尝试以下不同的方式:

$decorator = new Zend_Form_Decorator_Fieldset();
$decorator->setLegend("legend");        
$element->addDecorators(array($decorator));
    $decorator = new Zend_Form_Decorator_Fieldset();
    $decorator->setLegend("legend");

    $element->setDecorators(array(
        'ViewHelper',
        'Description',
        'Errors',
        array($decorator),
        array(array('div' => 'HtmlTag'), array('tag' => 'div')),
    ));        
$decorator = new Zend_Form_Decorator_Fieldset();
$decorator->setLegend("legend");        
$element->addDecorators(array($decorator));