重定向/转发到另一个动作并在symfony中发送帖子参数

Pro*_*mer 2 php post symfony1 http-post symfony-1.4

在我的情况下,我有一个带登录名和密码的小表单,一旦提交,登录/通行证用于打开一个imap conn来检索用户的电子邮件,一旦在同一个动作中检索到的电子邮件数组,我想重定向到另一个动作使用该阵列的其他treatements!

怎么可能?我的意思是重定向到另一个动作并将整个数组作为post参数发送

Mik*_*ail 9

您应该使用$this->forward()方法$this->getRequest()->setParameter()并在操作中.

例如:

  1. 在第一个动作中:

    $this->getRequest()->setParameter('emails',array('first@email.com','second@email.com','third@email.com'));
    
    $this->forward('anotherModule','anotherAction');
    
    Run Code Online (Sandbox Code Playgroud)
  2. 在另一个行动中:

    print_r($this->getRequest()->getParameter('emails'));
    
    Run Code Online (Sandbox Code Playgroud)