php解决前端调接口跨域问题

   header("Access-Control-Allow-Origin: *");
        header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
        header('Access-Control-Allow-Headers:Origin,Content-Type,Accept,token,X-Requested-With,device');
这三行都需要,特别是要在header头里面传参数的时候,后2行很有用。