防止冲突,备份
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,4 +2,6 @@ databases/*
|
||||
src/*
|
||||
public/message/static/src/video/*
|
||||
public/blog/md/post/*
|
||||
public/blog/md/image/*
|
||||
public/blog/md/image/*
|
||||
public/blog/md0/post/*
|
||||
public/blog/md0/image/*
|
||||
20
public/1index.php
Executable file
20
public/1index.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?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';
|
||||
}
|
||||
0
public/blog/fake_page.php
Normal file → Executable file
0
public/blog/fake_page.php
Normal file → Executable file
27
public/index.php
Executable file
27
public/index.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
// 定义条件
|
||||
$found_route = false;
|
||||
|
||||
|
||||
switch($request_uri){
|
||||
case '/':
|
||||
include './re_blog.php';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// posts 路由
|
||||
include "./request/posts.php";
|
||||
|
||||
|
||||
// 所有路由匹配结束后,检查是否找到路由
|
||||
if (!$found_route) {
|
||||
// 设置 HTTP 状态码为 404
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
// 包含 404 页面文件
|
||||
exit();
|
||||
include "../src/views/error/404.html";
|
||||
|
||||
}
|
||||
6
public/request/posts.php
Executable file
6
public/request/posts.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
switch($request_uri){
|
||||
case '/blog/md/post/';
|
||||
include '../src/views/posts.php';
|
||||
break;
|
||||
}
|
||||
BIN
public/static/error/cirno-image.jpg
Executable file
BIN
public/static/error/cirno-image.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user