ZF2表单HTML5数字元素不起作用

Din*_*nga 0 html5 element zend-form zend-framework2

这是我的表格

<?php
namespace Home\Form;

use Zend\Form\Form;

class CheckPriceForm extends Form
{

    public function __construct($name = null)
    {
        parent::__construct();

        $this->add(array(
            'name' => 'distance',
            'type' => 'Zend\Form\Element\Number',
            'options' => array(
                'label' => 'Distance',
            ),
        ));

        $this->add(array(
            'name' => 'weight',
            'type' => 'Zend\Form\Element\Number',
            'options' => array(
                'label' => 'Weight',
            ),
        ));

        $this->add(array(
            'name' => 'submit',
            'type' => 'Submit',
            'attributes' => array(
                'value' => 'Check Price',                
            ),
        ));
    }
}
Run Code Online (Sandbox Code Playgroud)

给出以下错误

/home/dinuka/workspace/free_courier/vendor/ZF2/library/Zend/I18n/Validator/Float.php:49

Zend\I18n\Validator component requires the intl PHP extension
Run Code Online (Sandbox Code Playgroud)

当我替换电子邮件号码时,它正在工作.请帮我.

小智 5

您的服务器上缺少intl扩展名.所以你需要安装它.

如果您使用的是Linux,请尝试使用以下命令

sudo apt-get install php5-intl

然后,您需要重新启动Apache

sudo service apache2 restart

对于Windows

/sf/answers/101623931/