我运用的是laravel框架,xampp搭建的apach环境,
header('content-type:application:json;charset=utf8');
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST');
header('Access-Control-Allow-Headers:x-requested-with,content-type');
我在php代码中加上了这样的header头,可是并没有用,
求指教!!!
找到问题了。问题出在laravel框架上,在原生的php语言中header('Access-Control-Allow-Origin:*');是可以跨域的。在laravel中就需要用到cors跨域插件了