新建一次合并、继续重构

This commit is contained in:
2025-08-22 11:00:35 +08:00
parent e62ae0968d
commit 6e79e2ee40
18 changed files with 677 additions and 64 deletions

View File

@@ -1,33 +1,30 @@
<?php
$file = './master/index.txt'; //定义文件的位置
if (file_exists($file)) {
$content = file_get_contents($file);
$file = '../../databases/no_db/post.text'; //定义文件的位置
//分割输出内容
$lines = explode("\n",$content);
$content = file_get_contents($file);
//逐行解析
foreach ($lines as $line) {
if (preg_match('/\{([^}]+)\};\{"([^"]+)\"}/', $line, $matches)) {
//分割输出内容
$lines = explode("\n",$content);
$sequence_id = 1; // 设定id起始数字
echo "文章如下: ";
foreach ($lines as $line) {
if (preg_match('/\{([^}]+)\};\{"([^"]+)\"};/', $line, $matches)) {
$data = $matches[1]; // 提取出数据
$title = $matches[2]; // 提取出标题
echo "文章如下: ";
// 输出提取到的内容
echo "<br><br>";
echo "文章顺序ID: " . $sequence_id . "<br>"; // 输出顺序ID
echo "" . $data . "\n";
echo "" . $title . "\n";
echo "<a href='https://ww3.tw/blog/md/post/s/$data' style='color: black;'> 跳转页面</a>";
echo "<a href='https://ww3.tw/blog/md/post/s/$sequence_id' style='color: black;'> 跳转页面</a>";
//echo '链接 (URL): <a herf="">链接</a>';
$sequence_id++; // 每次循环后顺序ID加1
}
}
//输出内容
//echo "文件 '{$file}' 的内容是: <br><br>\n\n";
//echo $content;
} else {
echo "错误: 文件 '$file' 不存在 ";
}
?>