ソースを参照

fleat: update mp4

igb 13 時間 前
コミット
361240d3e3
1 ファイル変更13 行追加4 行削除
  1. 13 4
      usr/themes/beardocs/archive.php

+ 13 - 4
usr/themes/beardocs/archive.php

@@ -273,13 +273,22 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
                 $answer = ''; // 答案部分为空
             }
 
+            // 检查答案中是否包含.mp4结尾的链接
+            if (!empty($answer) && preg_match('/(https?:\/\/[^\s]+\.mp4)/', $answer, $mp4matches)) {
+                $mp4url = $mp4matches[1]; // 提取MP4链接
+                // 将MP4链接替换为视频播放器
+                $videoPlayer = '<div class="adress"><video src="' . $mp4url . "\" title=\"{$question}\" controls=\"controls\" width=\"100%\"></video> </div>";
+                // 将原来的MP4链接替换为视频播放器
+                $answer = str_replace($mp4url, $videoPlayer, $answer);
+            }
 
-            if($postContent)
-            {
+            //暂进屏蔽POSTCONTENT
+            // if($postContent)
+            // {
 
-                $answer=$postContent['text'];
+            //     $answer=$postContent['text'];
 
-            }
+            // }