// +---------------------------------------------------------------------- // [ 应用入口文件 ] 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);