问题
I have a question regarding the Leaf template engine.
How can I access the Session values in the Leaf Template? For instance to loop through Flash messages like in Laravel: https://laravel.com/docs/5.3/redirects#redirecting-with-flashed-session-data
I can't find a solution to accomplish this.
Thanks in advance
回答1:
The latest version of Vapor includes the request
by default when rendering views. Therefore you'll be able to access the session using
#(request.session) // in the latest version of Vapor
来源:https://stackoverflow.com/questions/40843100/access-session-in-leaf-template