cxhxy/public/index.php
2023-12-08 14:53:45 +08:00

59 lines
2.4 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
namespace think;
header('Content-Type: text/html;charset=utf-8');
header('Access-Control-Allow-Origin:*'); // *代表允许任何网址请求
header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE,PUT'); // 允许请求的类型
header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies
header('Access-Control-Allow-Headers: Content-Type,Content-Length,Accept-Encoding,X-Requested-with, Origin,x-csrf,Authorization,x-app-client-id,x-app-platform,x-app-version,x-csrf,x-mch-id,x-requested-time,x-requested-with,Language,access_token'); // 设置允许自定义请求头的字段
// comment out the following two lines when deployed to production
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
echo json_encode(['code'=>'0','msg'=>'ok']);
exit();
}
// 检测PHP环境
//if (version_compare(PHP_VERSION, '7.4.0', '<')) die('require PHP > 7.1.0 !');
// 检测php版本号
if (phpversion() < '7.4') {
exit('很抱歉由于您的PHP版本过低部分功能无法运行为了系统功能全面可用请升级到PHP7.4或更高版本,谢谢!');
}
define('INSTALL_URL', str_replace('\\', '/', dirname(__FILE__) . '/install/'));
// 判断是否安装
if (!is_file(INSTALL_URL . 'install.lock')) {
header("location:/install");
exit;
}
// 加载核心文件
require __DIR__ . '/../vendor/autoload.php';
header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE");
header("Access-Control-Allow-Headers:x-requested-with, Referer,content-type,token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->run();
$response->send();
$http->end($response);