前端开发使用的Angular,后端使用的php,前后端分离,因为跨域问题SESSIONID每次请求都会变化,前端的解决方法如下:
const options = {
headers: {
'Content-Type': 'application/json',
},
withCredentials: true
};
添加withCredentials
之后,若SESSIONID还是出现变化的情况,解决方法如下:
const options = {
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
crossDomain: true
};
添加crossDomain
用于解决出现跨域导致SESSIONID变化
参考链接