作者 lyh

gx

@@ -166,15 +166,11 @@ class ProofreadingController extends BaseController @@ -166,15 +166,11 @@ class ProofreadingController extends BaseController
166 preg_match_all($pattern, $strippedContent, $matches); 166 preg_match_all($pattern, $strippedContent, $matches);
167 $data = []; 167 $data = [];
168 $textContentArray = $matches[1]; 168 $textContentArray = $matches[1];
  169 + $textContentArray = array_filter($matches[1], function($item) {
  170 + return !empty(trim($item));
  171 + });
169 var_dump($textContentArray); 172 var_dump($textContentArray);
170 die(); 173 die();
171 -// $textContentArray = array_filter(, function($item) {  
172 -// if(!empty($item)){  
173 -// $content = trim($item);  
174 -// $trimmedString = preg_replace('/\s+/', ' ', $content);  
175 -// $data[] = $trimmedString;  
176 -// }  
177 -// });  
178 $uniqueArray = array_unique($data); 174 $uniqueArray = array_unique($data);
179 $textContentArray = array_values($uniqueArray); 175 $textContentArray = array_values($uniqueArray);
180 return $textContentArray; 176 return $textContentArray;