From ef2c204bae561b6ce77d8b34282035916c4ee2a7 Mon Sep 17 00:00:00 2001 From: skimrme Date: Tue, 5 Aug 2025 03:01:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=97=A5=E6=9C=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/blog/index.php | 42 ++++++++++++++++++++++---------- public/blog/master/index.php | 13 ++++++++++ public/blog/master/index.txt | 1 + public/blog/master/post_data.php | 34 ++++++++++++++++++++++++++ public/blog/read_file.php | 33 +++++++++++++++++++++++++ 5 files changed, 110 insertions(+), 13 deletions(-) create mode 100755 public/blog/master/index.php create mode 100755 public/blog/master/index.txt create mode 100755 public/blog/master/post_data.php create mode 100644 public/blog/read_file.php diff --git a/public/blog/index.php b/public/blog/index.php index b65c873..25d0667 100755 --- a/public/blog/index.php +++ b/public/blog/index.php @@ -33,7 +33,7 @@ 2025.07.30 - 新增post、模块,这是第一篇文章 + 新增post、模块,这是第一篇文章 @@ -77,18 +77,33 @@ -
- +
+
+
+
- - - #js_date{ - color: rgb(55, 0, 255); - font-size: 200%; - } - \ No newline at end of file + + + \ No newline at end of file diff --git a/public/blog/master/index.php b/public/blog/master/index.php new file mode 100755 index 0000000..18fede9 --- /dev/null +++ b/public/blog/master/index.php @@ -0,0 +1,13 @@ +master + + +
+ +
+
+ +
\ No newline at end of file diff --git a/public/blog/master/index.txt b/public/blog/master/index.txt new file mode 100755 index 0000000..e11442d --- /dev/null +++ b/public/blog/master/index.txt @@ -0,0 +1 @@ +{2025/07/30};{"第一篇文章"} \ No newline at end of file diff --git a/public/blog/master/post_data.php b/public/blog/master/post_data.php new file mode 100755 index 0000000..6ba8899 --- /dev/null +++ b/public/blog/master/post_data.php @@ -0,0 +1,34 @@ + 标签的 name 属性 +if (isset($_POST['data']) && !empty($_POST['data'])) { + + // 自动获取当前日期和时间 + $date = date('Y/m/d'); + + // 获取你在网页输入框中写的数据 + $data = $_POST['data']; + + // 3. 构建完整的单行内容,格式为 {日期};{数据},并以换行符 \n 结尾 + $content = "{" . $date . "};" . "{" . '"' . $data . '"' . "}" . "\n"; + + // 4. 将内容追加到文件末尾 + $result = file_put_contents($file, $content, FILE_APPEND | LOCK_EX); + + // 5. 检查是否写入成功并给出反馈 + if ($result !== false) { + echo "数据已成功写入到 " . $file . " 文件。你可以 返回。"; + } else { + echo "写入文件失败,请检查文件权限。"; + } + +} else { + // 如果没有接收到数据,返回错误信息 + echo "没有接收到任何数据。请 返回 重新输入。"; +} + +?> \ No newline at end of file diff --git a/public/blog/read_file.php b/public/blog/read_file.php new file mode 100644 index 0000000..6aebf72 --- /dev/null +++ b/public/blog/read_file.php @@ -0,0 +1,33 @@ +
"; + echo "" . $data . "\n"; + echo "" . $title . "\n"; + echo " 跳转页面"; + //echo '链接 (URL): 链接'; + } + } + + //输出内容 + //echo "文件 '{$file}' 的内容是:

\n\n"; + //echo $content; + } else { + echo "错误: 文件 '$file' 不存在 "; + } +?> \ No newline at end of file