在路由文件route.php中添加如下代码:
header(‘Access-Control-Allow-Origin: *’);
header(“Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept”);
header(‘Access-Control-Allow-Methods: POST,GET’);
if(request()->isOptions()){
exit();
}
TP5.1 跨域请求
最新推荐文章于 2023-04-26 13:27:07 发布