【发布时间】:2016-10-18 15:59:36
【问题描述】:
我使用 twig 作为模板引擎,效果很好,但我在输出 flash 消息时遇到了问题。这些都没有显示任何东西。
{{ this.flash.output() }}
只有 {{ content }} 有效,但它也会输出通知和 php 警告消息。
这就是我设置闪光灯的方式
$di->set('flash', function () {
$flash = new FlashDirect([
//tie in with twitter bootstrap classes
'error' => 'alert alert-danger',
'success' => 'alert alert-success',
'notice' => 'alert alert-info',
'warning' => 'alert alert-warning'
]);
return $flash;
});
这就是我将消息传递到闪存的方式
$this->flash->error('Please use the link sent to you by email');
任何帮助将不胜感激。
【问题讨论】:
-
能够使用 {{ content }} 而不是 {{ flash.output() }} 修复它