Zend framework2 在Zend Framework 2中的表单提交按钮中使用图像类型

Zend framework2 在Zend Framework 2中的表单提交按钮中使用图像类型,zend-framework2,Zend Framework2,我想使用图像类型的表单提交按钮。在Zend Framework 2中,这是如何实现的 我有正常提交按钮的代码: $this->add(array( 'name' => 'send', 'type' => 'Zend\Form\Element\Submit', 'attributes' => array( 'type' => 'submit', 'value' => 'Send', ), ));

我想使用图像类型的表单提交按钮。在Zend Framework 2中,这是如何实现的

我有正常提交按钮的代码:

$this->add(array(
    'name' => 'send',
    'type'  => 'Zend\Form\Element\Submit',
    'attributes' => array(
        'type' => 'submit',
        'value' => 'Send',
    ),
));

我尝试将类型更改为“Zend\Form\Element\Image”或将类型设置为“Image”,但不起作用

Zend\Form\Element\Image需要'src'属性,用法如下:

$form = new \Zend\Form\Form();
$form->add(array(
    'name' => 'send',
    'type'  => 'Zend\Form\Element\Image',
    'attributes' => array(
        'value' => 'Send',
        'src' => 'abc.jpg',
    ),
));

$helper = new Zend\Form\View\Helper\FormImage();
echo $helper($form->get('send'));
//output <input type="image" name="send" src="abc.jpg">
$form=new\Zend\form\form();
$form->add(数组)(
'name'=>'send',
'type'=>'Zend\Form\Element\Image',
'属性'=>数组(
'值'=>'发送',
'src'=>'abc.jpg',
),
));
$helper=new Zend\Form\View\helper\FormImage();
echo$helper($form->get('send'));
//输出
在表单类中

$this->add(array(
        'name' => 'submit',
        'attributes' => array(
            'type'  => 'image',
            'src'   => './images/signin.png',
            'height'=> '28',
            'width' => '98',
            'border'=> '0',
            'alt'   => 'SIGN IN'
        ),
    ));
In.phtml

echo $this->formRow($form->get('submit'));