允许跨域请求

header("Access-Control-Allow-Origin: * ");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    
    
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
    exit;
}

猜你喜欢

转载自blog.csdn.net/weixin_43784997/article/details/115234431