Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个在用户访问我的页面后 5 分钟内过期的 cookie。
我知道add_cookie()功能,但不知道如何将其设置为过期。
add_cookie()
scripts/response_main.ts您可以在文件中设置 cookie,如下所示:
scripts/response_main.ts
set_cookie("cookie_name", "cookie_val") cookie("cookie_name") { cookie.expires("Wed, 09 Jun 2021 10:18:14 GMT") }
查看此链接了解更多信息。