我想创建一个在用户访问我的页面后5分钟内过期的cookie。
我知道add_cookie()
功能,但不知道如何将其设置为过期。
答案 0 :(得分:3)
您可以在scripts/response_main.ts
文件中设置Cookie:
set_cookie("cookie_name", "cookie_val")
cookie("cookie_name") {
cookie.expires("Wed, 09 Jun 2021 10:18:14 GMT")
}
查看this link了解详情。