This commit is contained in:
ln1778 2024-06-20 10:09:40 +08:00
parent efc819d0b7
commit 2f4c95d8a2
1 changed files with 18 additions and 14 deletions

View File

@ -178,20 +178,24 @@ function getCookie(e) {
// 遍历cookie数组并处理每个cookie // 遍历cookie数组并处理每个cookie
for (var i = 0; i < cookieArray.length; i++) { for (var i = 0; i < cookieArray.length; i++) {
// 使用trim()方法去除前后的空格 // 使用trim()方法去除前后的空格
var cookiePair = cookieArray[i]?.split("=");
var cookieName = cookiePair[0]?.trim(); var cookiePair = cookieArray[i].split("=");
var cookieValue = cookiePair[1]?.trim(); if(cookiePair.length>1){
var cookieName = cookiePair[0].trim();
// 如果你只对某个特定的cookie感兴趣可以添加条件判断 var cookieValue = cookiePair[1].trim();
if (cookieName === e) { // 如果你只对某个特定的cookie感兴趣可以添加条件判断
find=true; if (cookieName === e) {
r(cookieValue); find=true;
} r(cookieValue);
if(i==cookieArray.length-1){ }
if(!find){ if(i==cookieArray.length-1){
r(false); if(!find){
} r(false);
} }
}
}else{
r(false);
}
} }
}); });
} }