index.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. // [ 应用入口文件 ]
  12. namespace think;
  13. /*
  14. * 不在tp加载后判断,为了安全的使用exit()
  15. * 使用绝对路径,确保花里胡哨的url均能正确判定和跳转
  16. */
  17. header("Access-Control-Allow-Credentials: true");
  18. header("Access-Control-Max-Age: 86400");
  19. header("Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS");
  20. header("Access-Control-Allow-Origin: *");
  21. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  22. header("Access-Control-Allow-Headers: " . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
  23. exit();
  24. }
  25. //$rootPath = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR;
  26. //$server = isset($_REQUEST['server']) || isset($_SERVER['HTTP_SERVER']) || substr($_SERVER['REQUEST_URI'], 1, 9) == 'index.php';
  27. //if (!$server) {
  28. // // 用户访问前端
  29. //
  30. // // 安装检测-s
  31. // if (!is_file($rootPath . 'install.lock') && is_file($rootPath . 'install' . DIRECTORY_SEPARATOR . 'index.html')) {
  32. // header("location:" . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR);
  33. // exit();
  34. // }
  35. // // 安装检测-e
  36. //
  37. // /*
  38. // * 检测是否已编译前端-s
  39. // * 如果存在 index.html 则访问 index.html
  40. // */
  41. // if (is_file($rootPath . 'index.html')) {
  42. // header("location:" . DIRECTORY_SEPARATOR . 'index.html');
  43. // exit();
  44. // }
  45. // // 检测是否已编译前端-e
  46. //}
  47. /**
  48. * thinkphp正常加载流程
  49. */
  50. // 加载composer依赖
  51. require __DIR__ . '/../vendor/autoload.php';
  52. // 执行HTTP应用并响应
  53. $http = (new App())->http;
  54. $response = $http->run();
  55. $response->send();
  56. $http->end($response);