Cancel Twig Session Variables

How can we destroy the session variable in twig? I can get session variables app.session.get ('$ name'). And I want to destroy it later for some purposes.

Thanx!

+4
source share
1 answer

Flash messages are the right way to do this.

Symfony2 cookbook example:

{% if app.session.hasFlash('notice') %} <div class="flash-notice"> {{ app.session.flash('notice') }} </div> {% endif %} 

For more information, check out the Symfony Flash message documentation.

+4
source

All Articles