相关疑难解决方法(0)

Zend框架中重定向和转发有什么区别

Zend框架中重定向和转发有什么区别?

什么时候应该使用重定向,什么时候应该使用前进?

php zend-framework

37
推荐指数
2
解决办法
2万
查看次数

可以在没有重定向的情况下使用FlashMessenger吗?

我想知道它是否可以使用flash messenger而无需重定向?例如.登录失败后,我想继续显示表单,不需要重定向.

public function loginAction() {
  $form = new Application_Form_Login();

  ...

  if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getParams())) {
    $authAdapter = new Application_Auth_Adapter($form->getValue('username'), $form->getValue('password'));
    if ($this->auth->authenticate($authAdapter)->isValid()) {
      ...
    } else {
      // login failed
      $this->flashMessenger->addMessage('Login failed. You may have entered an invalid username and/or password. Try again');
    }
  }

  $this->view->form = $form;
}
Run Code Online (Sandbox Code Playgroud)

zend-framework

5
推荐指数
1
解决办法
4963
查看次数

标签 统计

zend-framework ×2

php ×1