|
@@ -299,9 +299,15 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
|
// $truncatedContent = substr($truncatedContent, 0, $maxLength - 3) . '...';
|
|
|
// }
|
|
|
|
|
|
- $parts = explode('?', $contentWithoutNumber, 2); // 最多分割成两部分
|
|
|
- $question = trim($parts[0]) . '?'; // 问题部分加上 ?
|
|
|
- $answer = isset($parts[1]) ? trim($parts[1]) : ''; // 答案部分
|
|
|
+ // 按第一个问号(?)或句号(.)分割问题和答案
|
|
|
+ if (preg_match('/^([^?.]+[?.])/', $contentWithoutNumber, $matches)) {
|
|
|
+ $question = trim($matches[0]); // 问题部分(包括问号或句号)
|
|
|
+ $answer = trim(substr($contentWithoutNumber, strlen($matches[0]))); // 答案部分
|
|
|
+ } else {
|
|
|
+ // 如果没有问号或句号,则整个内容作为问题
|
|
|
+ $question = trim($contentWithoutNumber);
|
|
|
+ $answer = ''; // 答案部分为空
|
|
|
+ }
|
|
|
?>
|
|
|
|
|
|
<div class="uk-card uk-card-category uk-card-default uk-card-hover uk-card-body uk-inline uk-border-rounded uk-width-1-1">
|