Commit 70b100cb by gongyang

提交代码

parent 9f423879
Showing with 1 additions and 3 deletions
......@@ -17,9 +17,7 @@ use Illuminate\Routing\Controller;
ini_set("error_reporting","E_ALL & ~E_NOTICE");
// 1. 设置允许跨域的源地址(精准匹配你的前端域名)
$allowedOriginArr = [
'http://wms.liexin.net','http://order2.xiaokang.liexinlocal.com'
];
$allowedOriginArr = explode(',',env('ALLOWORIGIN','http://wms.liexin.net,http://order2.xiaokang.liexinlocal.com'));
// 2. 检查请求头中的Origin是否为允许的域名
if (isset($_SERVER['HTTP_ORIGIN']) && in_array($_SERVER['HTTP_ORIGIN'],$allowedOriginArr)) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
......
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