Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

44 righe
2.2 KiB

  1. <?php
  2. // 允许跨域
  3. header('Access-Control-Allow-Origin:*');//允许跨域
  4. header("Access-Control-Allow-Headers:*");
  5. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  6. header('Access-Control-Allow-Headers:platform,lang,x-requested-with,content-type,token');//浏览器页面ajax跨域请求会请求2次,第一次会发送OPTIONS预请求,不进行处理,直接exit返回,但因为下次发送真正的请求头部有带token,所以这里设置允许下次请求头带token否者下次请求无法成功
  7. exit("ok");
  8. }
  9. //
  10. //
  11. ///**======设置跨域cookies传递===开始=====*/
  12. //header("Access-Control-Allow-Methods: GET,POST");
  13. //header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-cookies");
  14. //header("Access-Control-Allow-Credentials:true");//如果服务端不设置响应头,响应会被忽略不可用;同时,服务端需指定一个域名(Access-Control-Allow-Origin:www.zawaliang.com),而不能使用泛型(Access-Control-Allow-Origin: *)
  15. //header("Access-Control-Max-Age:60");
  16. //$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '*';
  17. //header('Access-Control-Allow-Origin:'.$origin);
  18. //header("Access-Control-Allow-Headers:platform,lang,Origin, X-Requested-With, Content-Type, Accept, Set-cookies");
  19. /**======设置跨域cookies传递===结束=====*/
  20. // +----------------------------------------------------------------------
  21. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  22. // +----------------------------------------------------------------------
  23. // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
  24. // +----------------------------------------------------------------------
  25. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  26. // +----------------------------------------------------------------------
  27. // | Author: liu21st <liu21st@gmail.com>
  28. // +----------------------------------------------------------------------
  29. // [ 应用入口文件 ]
  30. // 定义应用目录
  31. define('APP_PATH', __DIR__ . '/../application/');
  32. // 判断是否安装
  33. if (!is_file(APP_PATH . 'admin/command/Install/install.lock'))
  34. {
  35. header("location:./install.php");
  36. exit;
  37. }
  38. // 加载框架引导文件
  39. require __DIR__ . '/../thinkphp/start.php';