Symfony: pass parameter between actions (with a redirect)

后端 未结 3 1832
清酒与你
清酒与你 2021-01-18 07:35

I am redirecting from one action (executeProcess) to another (executeIndex). I want to be able to pass a parameter/variable along, without using GET (e.g. $this->re

3条回答
  •  既然无缘
    2021-01-18 08:33

    Another solution that does not redirect the browser

    class someActionClass extends sfActions{
      function myExecute(){
        $this->getRequest()->setParameter('myvar', 'myval');
        $this->forward('mymodule', 'myaction')
      }
    }
    
    
    //Here are your actions in another module
    
    class someActionClass2 extends sfActions{
      function myExecute2(){
    
        $myvar = $this->getRequest()->getParameter('myvar');
    
      }
    }
    

    `

提交回复
热议问题