index.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. require __DIR__ . '/../vendor/autoload.php';
  14. define('ROOT_DIR',__DIR__);//定义根目录物理路径
  15. define('WEB_DIR',dirname($_SERVER['SCRIPT_NAME']));//定义根目录虚拟路径
  16. header("Access-Control-Allow-Credentials:true");
  17. header("Access-Control-Allow-Origin:*");//注意修改这里填写你的前端的域名
  18. header("Access-Control-Max-Age:3600");
  19. header("Access-Control-Allow-Headers:*");
  20. //header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,SessionToken,X-Token");
  21. header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS, POIST');
  22. // 执行HTTP应用并响应
  23. $http = (new App())->http;
  24. $response = $http->run();
  25. $response->send();
  26. $http->end($response);