Browse Source

checkredis

yuenan
娄梦宁 3 years ago
parent
commit
a7f9f39c85
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      public/index.php

+ 2
- 1
public/index.php View File

@@ -1,6 +1,8 @@
<?php

// 允许跨域
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");
@@ -15,7 +17,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
//$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '*';
//header('Access-Control-Allow-Origin:'.$origin);
//header("Access-Control-Allow-Headers:platform,lang,Origin, X-Requested-With, Content-Type, Accept, Set-cookies");
header("Access-Control-Allow-Headers:*");
/**======设置跨域cookies传递===结束=====*/

// +----------------------------------------------------------------------


Loading…
Cancel
Save