项目报错

Failed to load https://xx.com?page=2: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

header('Content-Type: text/html;charset=utf-8');  
header('Access-Control-Allow-Origin:*'); // *代表允许任何网址请求  
header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE'); // 允许请求的类型  
header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies  
header('Access-Control-Allow-Headers: Content-Type,Content-Length,Accept-Encoding,X-Requested-with, Origin'); // 设置允许自定义请求头的字段
最后修改于:2019-02-08 20:33
文章链接: https://oct.cn/view/5
版权声明: 本站所有文章除特别声明外。转载请注明来自 十月笔记