关于tp5.1.39 LTS axios跨域问题

浏览:867 发布日期:2020/09/16 分类:ThinkPHP5专区 关键字: tp5.1.39LTS 设置跨域 axios
如题,我在5.1.1版本里在route/route.php中设置header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept,token");
header('Access-Control-Allow-Methods: POST,GET');
可以实现跨域,但是用5.1.39就不管用了,其他的办法如中间件,请求跨域里的Route::get('new/:id',    'News/read') 
->ext('html') 
->header('Access-Control-Allow-Origin','thinkphp.cn') ->header('Access-Control-Allow-Credentials',    'true') ->allowCrossDomain();
来设置跨域就不管用了,查了一上午,没一个能管用的,求大神科普啊
最佳答案
评论( 相关
后面还有条评论,点击查看>>