Files
open-ww3-project-ww3-tw/public/1index.php
2025-08-19 13:10:29 +08:00

20 lines
469 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// 获取请求的 URL 路径
$requestUri = $_SERVER['REQUEST_URI'];
$path = strtok($requestUri, '?');
// 定义路由规则
$routes = [
'/' => 're_blog.php',
'/blog/md/post/s/' => '../src/views/posts.php',
];
// 根据 URL 找到对应的文件
if (array_key_exists($path, $routes)) {
require $routes[$path];
} else {
// 如果找不到对应的 URL返回 404 错误
http_response_code(404);
require '../src/views/error/404.html';
}