首页 > 代码库 > node.js获取cookie

node.js获取cookie

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();
      });
    }

  

node.js获取cookie