以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 内部函数,使用StringBuilder写html+css+js网页,cookie可以设置时间参数吗?也就是可以设置第三个参数么? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153894) |
|
-- 作者:zhangjian222200 -- 发布时间:2020/8/26 19:38:00 -- 内部函数,使用StringBuilder写html+css+js网页,cookie可以设置时间参数吗?也就是可以设置第三个参数么? 如题 AppendCookie(Name, Value, Expires)
Name: Cookie名称 Value: Cookie值 Expires:可选参数,整数型,用于设置Cookie的有效时间,单位是分钟,如果不设置,关闭浏览器后Cookie将失效。 [此贴子已经被作者于2020/8/26 19:41:46编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2020/8/27 8:58:00 -- 您自己都把帮助贴出来了,还要问,什么地方看不懂? Expires:可选参数,整数型,用于设置Cookie的有效时间
|
|
-- 作者:zhangjian222200 -- 发布时间:2020/8/27 9:09:00 -- Dim wb As New WeUI Dim cnt As Integer = 1 If e.Cookies.ContainsKey("count") \'如果存在名为count的Cookie Integer.TryParse(e.Cookies("count"),cnt) \'提取cookie的值, 并转换为整数 cnt = cnt + 1 End If wb.AppendCookie("count",cnt) 帮助上是wb.AppendCookie wb.InsertHTML("您这是第" & cnt & "次访问!") e.WriteString(wb.Build) 下面StringBuilder页面 Dim e As RequestEventArgs = args(0)
[此贴子已经被作者于2020/8/27 9:15:18编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2020/8/27 9:33:00 -- 这种用法无法使用weui了,需要自己使用原生的用法自己写js控制 https://www.runoob.com/js/js-cookies.html https://developer.mozilla.org/zh-CN/docs/Web/API/Document/cookie
|