Commit f87e1204 by gongyang

提交代码

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