|
@@ -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 {
|