跨域cookie使用

$.ajaxSetup({
            xhrFields:{
                withCredentials:true,
            }
        });
header("Access-Control-Allow-Origin:http://localhost:9999");//使用cookie时此处不可用通配符
header("Access-Control-Allow-Headers:X-Request-With,Content-Type");
header('Access-Control-Allow-Credentials:true');//必须为true,和withCredentials:true配置对应

  

原文地址:https://www.cnblogs.com/flytome/p/10601820.html