Access Session in Leaf template

不羁的心 提交于 2019-12-11 06:18:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!