<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
//phpinfo();exit;
// 应用入口文件
header('Access-Control-Allow-Origin: *');

header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies

header('Access-Control-Expose-Headers: *');  //服务器 headers 白名单，可以让客户端进行访问

header('Access-Control-Allow-Headers:*');

// 检测PHP环境
// if(substr(PHP_VERSION, 0, 3) != '7.3')  die('require PHP == 7.3 !');

// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG', true);


// 检查是否是 .txt 文件的请求（例如 /index.php/xxx.txt）
$requestUri = $_SERVER['REQUEST_URI'];
if (preg_match('~/index\.php/([^/]+\.txt)$~', $requestUri, $matches)) {
    $fileName = $matches[1]; // 获取文件名（如 gMHr0ztnUm.txt）

    // 定义校验文件存储目录（建议放在安全目录，避免直接访问）
    $filePath = __DIR__ . '/' . $fileName;

    // 如果文件存在，直接返回内容
    if (file_exists($filePath)) {
        header('Content-Type: text/plain');
        echo file_get_contents($filePath);
        exit;
    } else {
        // 文件不存在，返回404
        header('HTTP/1.1 404 Not Found');
        exit;
    }
}

// 定义应用目录
define('APP_PATH', './Application/');/*

require './vendor/autoload.php';​*/
// 引入ThinkPHP入口文件
if (!is_file(APP_PATH . 'Common/Conf/config.php')) {
    header('Location: ./install.php');
    exit;
}
require './ThinkPHP/ThinkPHP.php';

// 亲^_^ 后面不需要任何代码了 就是如此简单