简体   繁体   中英

Zend FlashMessenger

Having an issue, don't know why this is happening:

In the first instance, everything works just fine, the message is set and it displays:

$this->_helper->FlashMessenger()
              ->setNamespace('success')
              ->addMessage('Success!')
              ->addMessage('User ' . $this->_request->getPost('user_name') . ' sucessfully added!');
$this->redirect('users/index');

However, in this instance, it fails with the message:

Warning: Missing argument 1 for Zend_Controller_Action_Helper_FlashMessenger::direct()

$this->_helper->FlashMessenger()
              ->setNamespace('error')
              ->addMessage('Failure!')
              ->addMessage('User was not added, please see errors below.');

Try changing your code to:

$this->_helper->getHelper('FlashMessenger')
              ->setNamespace('error')
              ->addMessage('Failure!')
              ->addMessage('User was not added, please see errors below.');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM