diff --git a/.gitignore b/.gitignore
index de87f12..ff242eb 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,22 @@
+#### 忽略目录
+# 数据库
databases/*
+public/*.sql
+public/*.db
+
+# 博客文档
+
+
+# 管理员面板
+public/blog/master/passwd
+
+
+# 可能未知
public/message/static/src/video/*
-public/blog/md/post/*
-public/blog/md/image/*
-public/blog/md0/post/*
-public/blog/md0/image/*
\ No newline at end of file
+
+
+# 临时区
+public/blog/md/*
+public/blog/md0/*
+
+# 临时区
\ No newline at end of file
diff --git a/md/1.md b/md/1.md
new file mode 100755
index 0000000..3b1213b
--- /dev/null
+++ b/md/1.md
@@ -0,0 +1,11 @@
+# 今天、2025.7.30
+----
+
+blog 正式 完工
+
+测试
+
+**署名**
+
+
+SkimrMe_
\ No newline at end of file
diff --git a/md/MD.php b/md/MD.php
new file mode 100755
index 0000000..e53eaa5
--- /dev/null
+++ b/md/MD.php
@@ -0,0 +1,479 @@
+
+
+
+
+file = $filename; //设置当前文件
+ $this->mdGen = $this->content($filename); //获取生成器
+ $this->flag = 'idel'; //闲置
+ $this->lines = array(); //所有行状态
+ $this->line_count = 0; //行数归0
+ }
+
+ private function content($file){ //获取生成器
+ if(file_exists($file)){
+ $fh = fopen($file,"r");
+ while(!feof($fh)){
+ yield fgets($fh);
+ }
+ fclose($fh);
+ }else{
+ return null;
+ }
+ }
+
+ //遍历每一个字符
+ private function every($str){
+ $l = strlen($str);
+ for($i=0;$i<$l;$i++)
+ if(ord($str[$i])<0x80)
+ yield $str[$i];
+ else{
+ yield $str[$i].$str[$i+1].$str[$i+2]; //三个字节
+ $i+=2;
+ }
+ }
+
+ //解析
+ private function parse(){
+ $ctnt = $this->mdGen; //生成器
+ $ret=array();
+ if($ctnt != null){
+ $ret = array();
+ foreach($ctnt as $line){
+ if($this->flag != 'code')
+ $line=ltrim($line); //删除左边
+ if(strlen($line)){
+ $ch = $line[0]; //判断第一个字符
+ $type=ctype_punct($ch);//标点符号
+ if($this->flag !== 'code') $line=preg_replace('/\s{2,}$/','
',$line); //非代码模式
+ $ret[] = $this->parseLine($line,$type); //解析行
+ }else{ //空行
+ switch($this->flag){
+ case 'ul':
+ case 'ol':
+ $ret[]="$this->flag>";
+ $this->flag_pre = $this->flag;
+ $this->flag = 'idel';
+ break;
+ case 'table':
+ $this->flag = 'idel';
+ $ret[]='';
+ break;
+ default:
+ if($this->flag != 'el') $ret[] = '
';
+ $this->flag = 'el'; //空行
+ }
+ }
+ }
+ }
+ $this->lines = $ret;
+ return $ret;
+ }
+
+ //生成blockquote
+ private function genQuote($level,$content){
+ if($level<=0) return "";
+ return str_repeat('
',$level).$content.str_repeat('
',$level);
+ }
+
+ //检查是否处于某个状态,默认检查是否处于代码状态
+ private function check($value='code'){
+ return ($this->flag == $value);
+ }
+
+ /**
+ * 生成一行新的表格列
+ * $data:需要输入的数据
+ * $type:生成类型
+ * $wrap:最快层包裹
+ * $sep:分隔符
+ */
+ private function genRow($data,$type='td',$wrap='tr',$sep='|'){
+ $ret='';
+ $mat = explode($sep,$data);
+ foreach($mat as $elem)
+ $ret.="<$type>".$elem."$type>";
+ return "<$wrap>".$ret."$wrap>";
+ }
+
+ /**
+ * 解析行内元素
+ * bold,italic,code,link,pic
+ */
+ private function parseInner($str){
+ $str=preg_replace('/\*\*\*([^\*\n\r]+)\*\*\*/','\1',$str); //加粗并加斜字体
+ $str=preg_replace('/\*\*([^\*\n\r]+)\*\*/','\1',$str); //加粗字体
+ $str=preg_replace('/\*([^\*\n\r]+)\*/','\1',$str); //斜体
+ $str=preg_replace('/```([^`\n\r]+)```/','\1',$str); //代码
+ $str=preg_replace('/`([^`\n\r]+)`/','\1',$str); //代码
+ $str=preg_replace('/!\[([^\]\r\n]+)\]\(([^\)\r\n]+)\)/','
',$str); //图片
+ $str=preg_replace('/\[([^\]\r\n]+)\]\(([^\)\r\n]+)\)/','\1',$str); //图片
+ return $str;
+ }
+
+ /**
+ * 按照给定规则解析字符串:
+ * type:
+ * true 符号
+ * false 文字
+ * 返回:
+ * array('type'=>类型,'parts'=>array(...))
+ */
+ private function parseLine($str,$type){
+ if(strlen($str) == 0){
+ return array('type'=>'p','parts'=>[]); //返回空段
+ }
+
+ $valid_str = rtrim($str); //去除右边的空格
+
+ $str = $valid_str;
+ $output = ''; //需要输出的字符串
+
+ if($type == true){ //标点
+ $type_str = ''; //类型字符串
+ $data_str = '';
+ $flag = 0;
+
+ foreach($this->every($str) as $ch){
+ if(!ctype_punct($ch)){
+ $flag = 1;
+ }
+ if($flag == 0)
+ $type_str .= $ch;
+ else
+ $data_str .= $ch;
+ }
+
+ switch($type_str){
+ case '#':
+ $wrap = 'h1';
+ $this->flag_like = 'h1';
+ break;
+ case '##':
+ $wrap = 'h2';
+ $this->flag_like = 'h2';
+ break;
+ case '###':
+ $wrap = 'h3';
+ $this->flag_like = 'h3';
+ break;
+ case '####':
+ $wrap = 'h4';
+ $this->flag_like = 'h4';
+ break;
+ case '#####':
+ $wrap = 'h5';
+ $this->flag_like = 'h5';
+ break;
+ case '######':
+ $wrap = 'h6';
+ $this->flag_like = 'h6';
+ break;
+ case '+':
+ case '-':
+ $wrap = 'li';
+ $this->flag_like = 'ul';
+ if($this->flag != 'code'){
+ if($this->flag != 'ul'){
+ $this->flag_pre = $this->flag;
+ $this->flag = 'ul';
+ $output.='';
+ }
+ }
+ break;
+ case '```': //代码模式,不进行干扰
+ if($this->flag != 'code'){ //不为code,判断是否为单行代码
+ $output.='
';
+ if(preg_match('/^\s*```([^`]+)```([^\s]+)\s*$/',$str,$mat)){ //单行代码
+ $output.="$mat[1]$mat[2]";
+ $str = '';
+ $data_str = '';
+ }else{
+ $this->flag_pre = $this->flag;
+ $this->flag = 'code'; //代码
+ }
+ }else{
+ $output.='';
+ $this->flag_pre = $this->flag;
+ $this->flag = 'idel'; //闲置
+ }
+ break;
+ case '[':
+ if(preg_match('/^\[\s\]\s*(.+)$/',$str,$mat)){ //选择
+ $output.="
";
+ $this->flag_like = 'check';
+ }else if(preg_match('/^\[([^\]]+)\]\(([^\)]+)\)([^\s]+)\s*$/',$str,$mat)){ //未选择
+ $output.="$mat[1]".$this->parseInner($mat[3]);
+ $this->flag_like = 'a'; //网址
+ }else if(preg_match('/^\s*(\[\d+\]\:)\s+([^\s]+)\s+([^\r\n]+)\s*$/',$str,$mat)){ //外部资料
+ $output.="$mat[1] $mat[3]";
+ }else{
+ $output.=$str;
+ }
+ break;
+ case '[-]':
+ $output.="
";
+ $this->flag_like = 'check';
+ break;
+ case '![':
+ if(preg_match('/^!\[([^\]]+)\]\(([^\)]+)\)([^\s]+)\s*$/',$str,$mat)){
+ $output.="
".$this->parseInner($mat[3]);
+ $this->flag_like = 'img';
+ }else{
+ $this->flag_like = 'p'; //没有模式
+ $output.="$str";
+ }
+ break;
+ case '*': //斜体
+ if(preg_match('/^\*(.*)\*([^\s]+)\s*$/',$str,$mat)){
+ $output.=$this->parseInner($str);
+ $this->flag_like = 'i';
+ }else if(preg_match('/^\s*\*\s+(.+)\s*$/',$str,$mat)){
+ $str=$mat[1];
+ $wrap = 'li';
+ $this->flag_like = 'ul';
+ if($this->flag != 'code'){
+ if($this->flag != 'ul'){
+ $this->flag_pre = $this->flag;
+ $this->flag = 'ul';
+ $output.='';
+ }
+ }
+ }
+ break;
+ case '**': //粗体
+ if(preg_match('/^\*\*(.*)\*\*/',$str,$mat)){
+ $output.=$this->parseInner($str);
+ $this->flag_like = 'b';
+ }
+ break;
+ case '<':
+ $output.=$str;
+ $this->flag_like = 'html';
+ break;
+ default:
+ if(!$this->check()){ //非代码模式
+ if(preg_match('/^>+$/',$type_str)){ //引用
+ $level = strlen($type_str);
+ $this->flag_like = 'quote';
+ $output.=$this->genQuote($level,$data_str); //引用
+ }else if(preg_match('/^([^\|\n\r]+)(?:\|[^\|\n\r]+)+$/',$str)){ //表格确定格式---|---|....
+ if($this->flag == 'table'){
+ $this->flag_like = 'table';
+ $output.=''.$this->genRow($this->buf,'th').'';
+ }else{ //非表格格式,上一行没有标题
+ $this->flag_like = 'p'; //没有格式
+ $output.=$this->buf;
+ $this->buf = '';
+ }
+ }else if(preg_match('/^\s*(\-{3,})|(\={3,})$/',$type_str)){ //hr
+ $output.='
';
+ $this->flag_like = 'hr';
+ break;
+ }else{
+ $this->flag_like = 'p';
+ $output.=$str.'
';
+ }
+ }
+ }
+ $br = '';
+ preg_match('/^(.*)(
)?$/',$data_str,$mat);
+ $data_str = htmlspecialchars($mat[1]);
+ if(!$this->check()){ //代码
+ if(!empty($wrap)) $output.="<$wrap>$mat[1]$wrap>".(isset($mat[2])?'
':'');
+ }else if($type_str!='```'){
+ $output.=htmlspecialchars($str).'
';
+ }
+ }else{ //首个非空字符不为符号
+ if($this->flag == 'code'){ //代码,直接输出
+ $str=str_replace("\t",' ',$str);
+ $output.=htmlspecialchars($str).'
';
+ }else if(is_numeric($str[0])){ //可能为有序列表,也可能是表格
+ if(preg_match('/^\s*\d+\.\s+([^\r\n]+)\s*$/',$str)){ //有序列表
+ $this->flag_like = 'ol';
+ $output.=$str;
+ }else{
+ $this->flag_like = 'idel';
+ foreach($this->every($str) as $ch){
+ $output.=$ch;
+ }
+ }
+ $output.='
';
+ }else if(preg_match('/^([^\|\n\r]+)(?:\|[^\|\n\r]+)+$/',$str)){ //表格
+ $mat = explode('|',$str);
+
+ if($this->flag!='table'){ //进入表格
+ $this->buf = $str;
+ $this->flag_like = 'table';
+ $wrap = '';
+ }else{
+ $output.=$this->genRow($str);
+ }
+ //echo $mat[0].'
';
+ //var_dump($mat);
+ }else{ //其他
+ $this->flag = 'p';
+ $output.=$str;
+ }
+ }
+
+ if(!$this->check()){ //不为代码,设置flag
+ $this->flag_pre = $this->flag;
+ $this->flag = $this->flag_like;
+ if($this->flag_pre == 'table' && $this->flag != 'table')
+ $output='
'.$output;
+ else if($this->flag_pre == 'ul' && $this->flag != 'ul'){
+ $output='
'.$output;
+ }
+ }
+
+ return $this->parseInner($output); //输出需要输出的内容
+ }
+
+ //获取输出内容
+ public function output(){
+ $this->parse();
+ echo implode('',$this->lines);
+ }
+}
diff --git a/md/inite.php b/md/inite.php
new file mode 100755
index 0000000..13d85d6
--- /dev/null
+++ b/md/inite.php
@@ -0,0 +1,6 @@
+output();
\ No newline at end of file
diff --git a/md/inte.md b/md/inte.md
new file mode 100755
index 0000000..f03fd97
--- /dev/null
+++ b/md/inte.md
@@ -0,0 +1,10 @@
+## MD介绍页面
+
+顾名思义、本文件夹下使用的基本都是markdown
+
+最后感谢提供php的md插件的开源制作者
+
+[点击跳转](https://ww3.tw/blog/md/src/php-markdown/)
+
+日期 2025.07.30
+
diff --git a/public/1index.php b/public/1index.php
deleted file mode 100755
index 6736b26..0000000
--- a/public/1index.php
+++ /dev/null
@@ -1,20 +0,0 @@
- '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';
-}
\ No newline at end of file
diff --git a/public/blog/index.php b/public/blog/index.php
index 8ad4713..a8f2732 100755
--- a/public/blog/index.php
+++ b/public/blog/index.php
@@ -31,6 +31,11 @@
+
+ | 2025.08.20 |
+ 路由模式修改完善、现在开始重写文章系统 |
+
+
| 2025.08.19 |
修改php_web的路由方式 |
diff --git a/public/blog/master/index.html b/public/blog/master/index.html
new file mode 100755
index 0000000..03ed4ec
--- /dev/null
+++ b/public/blog/master/index.html
@@ -0,0 +1,9 @@
+
+
+
+ master 页面
+
+
+ 跳转建立索引
+
+
\ No newline at end of file
diff --git a/public/blog/master/index.txt b/public/blog/master/index.txt
deleted file mode 100755
index e11442d..0000000
--- a/public/blog/master/index.txt
+++ /dev/null
@@ -1 +0,0 @@
-{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
index 6ba8899..f879e3f 100755
--- a/public/blog/master/post_data.php
+++ b/public/blog/master/post_data.php
@@ -1,27 +1,27 @@
标签的 name 属性
if (isset($_POST['data']) && !empty($_POST['data'])) {
-
- // 自动获取当前日期和时间
+
+ // 自动获取当前日期
$date = date('Y/m/d');
// 获取你在网页输入框中写的数据
$data = $_POST['data'];
- // 3. 构建完整的单行内容,格式为 {日期};{数据},并以换行符 \n 结尾
- $content = "{" . $date . "};" . "{" . '"' . $data . '"' . "}" . "\n";
+ // 3. 构建完整的单行内容
+ // 使用 PHP_EOL 常量确保正确的换行符
+ $content = "{" . $date . "};" . "{" . '"' . $data . '"' . "}" . ";" . PHP_EOL;
// 4. 将内容追加到文件末尾
$result = file_put_contents($file, $content, FILE_APPEND | LOCK_EX);
// 5. 检查是否写入成功并给出反馈
if ($result !== false) {
- echo "数据已成功写入到 " . $file . " 文件。你可以 返回。";
+ echo "数据已成功写入到 " . $file . " 文件。你可以 返回。";
} else {
echo "写入文件失败,请检查文件权限。";
}
diff --git a/public/blog/master/index.php b/public/blog/master/push.php
similarity index 51%
rename from public/blog/master/index.php
rename to public/blog/master/push.php
index 18fede9..70bc6b1 100755
--- a/public/blog/master/index.php
+++ b/public/blog/master/push.php
@@ -1,9 +1,8 @@
+
master
-
+