//存储
function __setCookie(key, value, day) {
var date = new Date();
date.setTime(date.getTime() + (Number(day) || 730)*24*60*60*1000);
document.cookie = key + '=' + value + ';expires=' + date.toGMTString() + ';path=/';
}
//读取cookie
'getCookie': function (cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i=0; i<ca.length; i++) {
let c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
},
读取、存储cookie
猜你喜欢
转载自blog.csdn.net/weixin_57163112/article/details/128441419
今日推荐
周排行