<?php
// 1. 强制开启调试模式（核心修复）
define('APP_DEBUG', true); 

// 2. 确保PHP显示错误（防止PHP配置屏蔽错误）
ini_set('display_errors', 'On'); 
error_reporting(E_ALL);

// --- 下面是原有的代码，不要动 ---
// require __DIR__ . '/../vendor/autoload.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>
// +----------------------------------------------------------------------

// 安装检测：未安装时自动跳转安装向导
$installLock = __DIR__ . '/install.lock';
if (!file_exists($installLock) && PHP_SAPI !== 'cli') {
    $installUrl = '/install.php';
    // AJAX 请求返回 JSON 提示
    if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
        header('Content-Type: application/json; charset=utf-8');
        echo json_encode(['code' => 0, 'msg' => '系统尚未安装，请先完成安装', 'redirect' => $installUrl], JSON_UNESCAPED_UNICODE);
        exit;
    }
    header('Location: ' . $installUrl);
    exit;
}

use think\App;

// [ 应用入口文件 ]

require __DIR__ . '/../vendor/autoload.php';

// 执行HTTP应用并响应
$http = (new App())->http;

$response = $http->run();

$response->send();

$http->end($response);
