跨域微信授权登录

微信授权跨域匹配用户openid信息,使用session、cookie方式
后端接口加入跨域设置

header("ACCESS-CONTROL-ALLOW-ORIGIN:允许的域名"); 

处理参数不带cookie值问题头部加入

header('Access-Control-Allow-Credentials:true'); 

允许方法设置

header('Access-Control-Allow-Methods:GET, POST, OPTIONS’);

前端ajax请求加入代码块

xhrFields:{
        withCredentials:true
    },

猜你喜欢

转载自blog.csdn.net/weixin_43507521/article/details/84626747
今日推荐