跨域请求后端解决方式
1.每个请必须都带有以下头,而非只有option请求才带
header(“Access-Control-Allow-Headers:x-requested-with,content-type,token”);
header(“Access-Control-Allow-Credentials:true”);
header(“Access-Control-Allow-Methods:POST,GET”);
header(“Content-Type:text/html;charset=utf-8”);
header(‘Access-Control-Allow-Origin:http://localhost:8080’);
2.如果是option请求需要
返回200状态码,比如php里面可以直接exit即可