Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zend framework Zend:如何创建图像选择表单并使用Zend上传图像?_Zend Framework_Zend Form - Fatal编程技术网

Zend framework Zend:如何创建图像选择表单并使用Zend上传图像?

Zend framework Zend:如何创建图像选择表单并使用Zend上传图像?,zend-framework,zend-form,Zend Framework,Zend Form,基本上,我想要一个表单,可以显示用户的默认模板集和上传图像,如果用户想上传自己的图像。大概是这样的: 我如何在Zend中实现这一点? 到目前为止,我已经尝试创建一个模板表单类 class application_forms_FormTemplate extends Zend_Form{ public function init() { $image = new Zend_Form_Element_Image('image', array('src' =>'/path/to/doc

基本上,我想要一个表单,可以显示用户的默认模板集和上传图像,如果用户想上传自己的图像。大概是这样的:

我如何在Zend中实现这一点? 到目前为止,我已经尝试创建一个模板表单类

class application_forms_FormTemplate extends Zend_Form{
public function init()
{
    $image = new Zend_Form_Element_Image('image', array('src' =>'/path/to/dock.jpg'));

    $template = $this->createElement('radio','tygTemplate');
    $template->addMultiOptions(
                    array(
                        'desert.jpg' => $image,
                        'dock.jpg' => 'something'
                    )
                )
            ->setSeparator('');

    $this->addElements(array(
                        $template,
                        //$image
                    ));
}}  
当我在视图中调用此表单时,我会得到单选按钮,但图像不会在单选按钮旁边渲染

我做错了什么,或者有人能给我指出更好的解决方案吗?
谢谢。

我现在无法测试它,但Zend表单可能有问题(默认情况下转义),请尝试以下操作:

$template = new Zend_Form_Element_Radio('template', array('escape' => false)); 
$template->addMultiOptions(array(
    'xxx.jpg' => $image,
));