在 ZF 中将变量从一个操作传递到另一个操作
我有这样的情况,
public function loginAction(){
//my other code
if(!empty($errorMessage)){
$this->view->assign('error',$errorMessage);
}
}
public function authAction(){
//my other code
if($result->isValid()){
$this->_redirect('/currentcontroller/controlpannel');}
else{
$errorMessage = "Wrong username or password provided. Please try again.";
$this->_redirect('/currentcontroller/login');
}
我想将 $errorMessage 传递给登录操作,否则如何传递它以及如何在那里检索它?
i have a situation like this
public function loginAction(){
//my other code
if(!empty($errorMessage)){
$this->view->assign('error',$errorMessage);
}
}
public function authAction(){
//my other code
if($result->isValid()){
$this->_redirect('/currentcontroller/controlpannel');}
else{
$errorMessage = "Wrong username or password provided. Please try again.";
$this->_redirect('/currentcontroller/login');
}
i want to pass $errorMessage to login action in else how to pass it and than how to retrive it there ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下 Flash Messenger 操作助手: http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.flashmessenger
它允许您设置消息(存储在会话中),您可以在下一个请求时访问这些消息。
Take a look at the flash messenger action helper: http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.flashmessenger
It allows you to set messages (which are stored in the session), which you can access on the next request.