Commit f91e80ae by gongyang

提交代码

parent 19505988
Showing with 2 additions and 8 deletions
......@@ -63,13 +63,6 @@ class NoticeController extends Controller
}
private function codeExport($errcode=0,$errmsg='成功',$data=''){
return response()->json(['code'=>$errcode,'msg'=>$errmsg,'data'=>$data])// 允许的源(生产环境替换为你的前端域名,如 https://www.example.com)
->header('Access-Control-Allow-Origin', '*')
// 允许的请求方法
->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
// 允许的请求头(包含前端常用的 Token/Content-Type 等)
->header('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With')
// 允许前端携带 Cookie(如需跨域传 Cookie 则添加)
->header('Access-Control-Allow-Credentials', 'true');
return response()->json(['code'=>$errcode,'msg'=>$errmsg,'data'=>$data]);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment