我的 ZF2 FlashMessenger 出现以下错误:
在第 306 行调用 /vendor/zendframework/zend-mvc/src/Controller/Plugin/FlashMessenger.php 中数组的成员函数 toArray()
FlashMessages 将由我的 FlashMessageHelper 呈现:
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\View\Helper\FlashMessenger;
class FlashMessageHelper extends AbstractHelper {
public function __invoke(FlashMessenger $flashMessenger) {
$flashMessenger->setMessageOpenFormat('<div%s><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><p class="text-center">');
$flashMessenger->setMessageSeparatorString('</p><p class="text-center">');
$flashMessenger->setMessageCloseString('</p></div>');
$flashMessenger->setAutoEscape(false);
echo $flashMessenger->render('error', array(
'alert',
'alert-dismissible',
'alert-danger'
));
echo $flashMessenger->render('info', array(
'alert',
'alert-dismissible',
'alert-info'
));
echo $flashMessenger->render('default', array(
'alert',
'alert-dismissible',
'alert-warning'
));
echo $flashMessenger->render('success', array(
'alert',
'alert-dismissible',
'alert-success'
));
}
}
?>
有人知道这个错误吗?这是第一次发生此错误。谷歌和“zend-mvc” - repo - 问题对此一无所知。
感谢您的关注!