php options 请求跨域

请求跨域,前端发送options请求时,加上一下请求头即可:

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');

注:加在入口文件

posted @ 2019-11-05 16:27  yahn~  阅读(4483)  评论(0编辑  收藏  举报