This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<?php
$uri = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
// 1. 如果请求的是 api.php,直接引入执行
if ($uri === '/api.php') {
require __DIR__ . '/api.php';
exit;
}
// 2. 如果请求的是真实存在的静态文件(如 assets/*.js, vite.svg),直接返回 false 让 PHP 内置服务器处理
if (file_exists(__DIR__ . $uri) && $uri !== '/') {
return false;
// 3. 其他所有路由(如 /login, /mail, /),全部返回 index.html
// 这样 React Router 才能接管页面渲染
readfile(__DIR__ . '/index.html');