cookie new了多个。同一个名字。会不会存在多个呢。

//若果不设置Cookie的path,则名字相同的Cookie视为相同的Cookie,后面的覆盖前面的,注意:大小写敏感
  Cookie c1=new Cookie("name", "v1");
  Cookie c2=new Cookie("name", "v2");
  //若设置了不同的path,即使Cookie名字相同,也视为不同的Cookie
  Cookie c3=new Cookie("name", "v1");
  c3.setPath("/");
  Cookie c4=new Cookie("name", "v2");
  c4.setPath("/web");
  //Cookie的默认path为当前请求URL的路径

相关文章:

  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2021-11-17
  • 2021-06-13
  • 2021-05-17
  • 2021-08-19
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-01
  • 2021-12-04
  • 2022-01-09
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案