正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
| @@ -164,15 +164,17 @@ class ProofreadingController extends BaseController | @@ -164,15 +164,17 @@ class ProofreadingController extends BaseController | ||
| 164 | $pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式 | 164 | $pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式 |
| 165 | $matches = array(); | 165 | $matches = array(); |
| 166 | preg_match_all($pattern, $strippedContent, $matches); | 166 | preg_match_all($pattern, $strippedContent, $matches); |
| 167 | - $textContentArray = array_filter($matches[1], function($item) { | 167 | + $data = []; |
| 168 | + array_filter($matches[1], function($item) { | ||
| 168 | if(!empty($item)){ | 169 | if(!empty($item)){ |
| 169 | $content = trim($item); | 170 | $content = trim($item); |
| 170 | $trimmedString = preg_replace('/\s+/', ' ', $content); | 171 | $trimmedString = preg_replace('/\s+/', ' ', $content); |
| 171 | - return $trimmedString; | 172 | + $data[] = $trimmedString; |
| 172 | } | 173 | } |
| 173 | }); | 174 | }); |
| 174 | - $textContentArray = array_values($textContentArray); | ||
| 175 | - $uniqueArray = array_unique($textContentArray); | 175 | + var_dump($data); |
| 176 | + die(); | ||
| 177 | + $uniqueArray = array_unique($data); | ||
| 176 | $textContentArray = array_values($uniqueArray); | 178 | $textContentArray = array_values($uniqueArray); |
| 177 | return $textContentArray; | 179 | return $textContentArray; |
| 178 | } | 180 | } |
-
请 注册 或 登录 后发表评论