Blogger Information
Blog 2
fans 0
comment 0
visits 2338
Related recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP解决接口跨域问题
彭刚的博客
Original
1634 people have browsed it

我们都知道不同源调用接口会有跨域问题 下面就是PHP解决跨域问题

header('content-type:text/html;charset=utf-8');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
header('Access-Control-Allow-Methods: GET, POST, PUT');
ksort($_POST);
ksort($_GET);

如果还是有跨域问题 可以切换下PHP版本 少部分版本不支持 有不会解决的可以联系1027976723

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post