当前位置:编程学习 > thinkphp >>

thinkphp开发 跨域调试处理方法

在thinkphp入口例如/public/index.php 加上
//支持跨域

header("'Access-Control-Allow-Credentials: true"); 

header("Access-Control-Allow-Origin: *"); 

header("Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, X-Token"); 

header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, PATCH');

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,