Browse Source

调试

undefined
v-Brocloni 4 years ago
parent
commit
dca8d7435f
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      public/index.php

+ 5
- 4
public/index.php View File

@@ -3,10 +3,11 @@
// 允许跨域
header('Access-Control-Allow-Origin:*');//允许跨域
header("Access-Control-Allow-Headers:*");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Headers:platform,lang,x-requested-with,content-type,token');//浏览器页面ajax跨域请求会请求2次,第一次会发送OPTIONS预请求,不进行处理,直接exit返回,但因为下次发送真正的请求头部有带token,所以这里设置允许下次请求头带token否者下次请求无法成功
exit("ok");
}
header("Access-Control-Allow-Methods: GET,POST,OPTION");
//if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
// header('Access-Control-Allow-Headers:platform,lang,x-requested-with,content-type,token');//浏览器页面ajax跨域请求会请求2次,第一次会发送OPTIONS预请求,不进行处理,直接exit返回,但因为下次发送真正的请求头部有带token,所以这里设置允许下次请求头带token否者下次请求无法成功
// exit("ok");
//}
//
//
///**======设置跨域cookies传递===开始=====*/


Loading…
Cancel
Save