Zend: Redirect to Action with parameters

前端 未结 5 1077
我寻月下人不归
我寻月下人不归 2020-12-13 18:19

I am using zend framework. I am using the following statement to redirect to another action.

$this->_helper->redirector(\'some_action\');
5条回答
  •  星月不相逢
    2020-12-13 19:02

    Use the Zend_Controller_Action::redirect() method (which just passes through to Sarfraz's helper method)

    $this->redirect('/module/controller/action/username/robin/email/robin@example.com');
    

    Note: _redirect() method is deprecated as of Zend Framework 1.7. Use redirect() instead.

    And then in the called action:

    $username = $this->_getParam('username');
    $email = $this->_getParam('email');
    

    _getParam() takes a second optional argument which is set to the variable as a default if the parameter isn't found.

提交回复
热议问题