node.js 获取cookie
var Cookies ={}; if (req.headers.cookie != null) { req.headers.cookie.split(‘;‘).forEach(l => { var parts = l.split(‘=‘); Cookies[parts[0].trim()] = (parts[1] || ‘‘).trim(); }); }
时间: 2024-10-21 00:05:32
node.js 获取cookie
var Cookies ={}; if (req.headers.cookie != null) { req.headers.cookie.split(‘;‘).forEach(l => { var parts = l.split(‘=‘); Cookies[parts[0].trim()] = (parts[1] || ‘‘).trim(); }); }