/*
** @author water
** @admin 跨域问题
** @2018-10-10
**
*/
public function _initialize(){
$this->cross();
}
public function cross(){
header('Content-Type:application/json; charset=utf-8');
header('Access-Control-Allow-Origin:前端域名地址');
//header('Access-Control-Max-Age:86400');
header('Access-Control-Allow-Methods:OPTIONS,POST,PUT,DELETE');
}
ThinkPHP3 解决前后端分离项目跨域问题
最新推荐文章于 2023-11-17 09:18:32 发布