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.
 
 
 
 
 
 

45 righe
2.3 KiB

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