[英]how to get cookie in template webpy
如何在index.html
模板中獲取Cookie:
render = web.template.render('templates/', base='layout', cache=False)
import web
template_globals = {
"cookies": web.cookies,
}
render = web.template.render('templates/', globals=template_globals, base='layout', cache=False)
您還可以執行以下操作:
render_partial = web.template.render('templates/', globals=template_globals)
template_globals.update(render=render_partial)
然后,您將能夠在模板中呈現部分模板
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.