【发布时间】:2013-10-30 20:17:21
【问题描述】:
我尝试对设置的 session-flash 做出反应,但总是得到 else-path
Symfony 2.1.3
控制器:
$this->get('session')->getFlashBag()->set('contactActionNoticeError', 'Message not sent');
查看(尝试“旧”和新样式)但我得到 bla2
{% if app.session.flashbag.has("contactActionNoticeError") or app.session.hasFlash("contactActionNoticeError") %}
bla1
{% else %}
bla2
{% endif %}
当显示所有闪烁时:
{% for label, flashes in app.session.flashbag.all %}
{% for flash in flashes %}
{{ label }} - {{ flash }}
{% endfor %}
{% endfor %}
我明白了:
contactActionNoticeError - Message not sent
【问题讨论】:
标签: php symfony twig symfony-2.1