소스 검색

fleat:update template

igb 1 개월 전
부모
커밋
4c0b8a6589
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      usr/themes/beardocs/archive.php

+ 5 - 2
usr/themes/beardocs/archive.php

@@ -299,8 +299,11 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
 //                $truncatedContent = substr($truncatedContent, 0, $maxLength - 3) . '...';
 //            }
 
-        // 按第一个问号(?)或句号(.)分割问题和答案
-            if (preg_match('/^([^?.]+[?.])/', $contentWithoutNumber, $matches)) {
+            // 将全角问号(?)和句号(。)替换为半角问号(?)和句号(.)
+            $contentWithoutNumber = str_replace(['?', '。'], ['?', '.'], $contentWithoutNumber);
+
+            // 按第一个问号(?)或句号(.)分割问题和答案
+            if (preg_match('/^([^?.]+[?.])/', $contentWithoutNumber, $matches)) {
                 $question = trim($matches[0]); // 问题部分(包括问号或句号)
                 $answer = trim(substr($contentWithoutNumber, strlen($matches[0]))); // 答案部分
             } else {