// [ 应用入口文件 ] // 兼容 Nginx 未配置 URL 重写的情况 $__uri = $_SERVER['REQUEST_URI'] ?? ''; $__path = parse_url($__uri, PHP_URL_PATH); // 处理 index.php/xxx 格式的 URL if (strpos($__path, 'index.php') !== false) { $__parts = explode('index.php', $__path, 2); if (!empty($__parts[1]) && $__parts[1] !== '/') { $_SERVER['PATH_INFO'] = $__parts[1]; $_GET['s'] = ltrim($__parts[1], '/'); } } // 如果已设置 s 参数,优先使用 if (!isset($_GET['s']) || empty($_GET['s'])) { // 处理无后缀路径的重写 if ($__path !== '/' && pathinfo($__path, PATHINFO_EXTENSION) === '') { $_GET['s'] = ltrim($__path, '/'); $_SERVER['PATH_INFO'] = $__path; } } require __DIR__ . '/../vendor/autoload.php'; // 执行HTTP应用并响应 $app = new think\App(); // 记录调试信息 $debugDir = __DIR__ . '/../runtime/log'; if (!is_dir($debugDir)) { @mkdir($debugDir, 0777, true); } $http = $app->http; $response = $http->run(); $response->send(); $http->end($response);