Php Zend传递字符串,其中包含;“零”;形成元素描述

Php Zend传递字符串,其中包含;“零”;形成元素描述,php,zend-framework,forms,zend-decorators,Php,Zend Framework,Forms,Zend Decorators,Zend talk。我建立了一个Zend_表单类。 我注意到,如果我通过字符串“0”,我的表单元素的方法集描述将被认为是NULL,并且我无法在元素描述中回响它的值。 //this is how I set the element description in Myform class: $element->setDescription('0'); 我怎样才能避免呢 谢谢 卢卡我就是这样做的 abstract class Gestionale_Form_Abstract_Form exte

Zend talk。我建立了一个Zend_表单类。 我注意到,如果我通过字符串“0”,我的表单元素的方法集描述将被认为是NULL,并且我无法在元素描述中回响它的值。
//this is how I set the element description in Myform class:
$element->setDescription('0');
我怎样才能避免呢

谢谢

卢卡

我就是这样做的

abstract class Gestionale_Form_Abstract_Form extends Zend_Form
{
    protected $_myParams;//params per customizzare il form in base all'action edit/new

    public function __construct($options = null, $myParams = null)
    {
        $this->_myParams = $myParams;
        parent::__construct($options);
    }

然后举个例子

class Form_Contatto extends Gestionale_Form_Abstract_Form
...
    $clienteid->setValue($this->_myParams['data']['id']);//

我会尝试在其周围添加一些空格,或者禁用自动转义并将0包装到span或其他标记中。

根据,php将“0”识别为空

函数的作用是:检查描述是否为空()。目前似乎没有办法只显示“0”

我建议在

在这一点改变之前,最好的办法是创建自己的描述装饰器,扩展Zend装饰器并改变行为。

Ho riformulato la domanda=)anche io sono di Roma。。非ci conosciamo??我的装饰器设置:“数组('Description',数组('tag'=>'h2','placement'=>'append','escape'=>false))”。你的建议都不管用。谢谢