正在显示
1 个修改的文件
包含
7 行增加
和
4 行删除
| @@ -250,10 +250,13 @@ class ProofreadingController extends BaseController | @@ -250,10 +250,13 @@ class ProofreadingController extends BaseController | ||
| 250 | $context = stream_context_create($contextOptions); | 250 | $context = stream_context_create($contextOptions); |
| 251 | $sourceCode = file_get_contents($url, false, $context); | 251 | $sourceCode = file_get_contents($url, false, $context); |
| 252 | preg_match_all($pattern, $sourceCode, $matches); | 252 | preg_match_all($pattern, $sourceCode, $matches); |
| 253 | - $textContentArray = array_filter($matches[1], function($item) { | ||
| 254 | - return !empty(trim($item)); | ||
| 255 | - }); | ||
| 256 | - $data = array_values($textContentArray); | 253 | + $textContentArray = $matches[1]; |
| 254 | + $data = []; | ||
| 255 | + foreach ($textContentArray as $v){ | ||
| 256 | + if(!empty($v)){ | ||
| 257 | + $data[] = $v; | ||
| 258 | + } | ||
| 259 | + } | ||
| 257 | $uniqueArray = array_unique($data); | 260 | $uniqueArray = array_unique($data); |
| 258 | $data = array_values($uniqueArray); | 261 | $data = array_values($uniqueArray); |
| 259 | return $data; | 262 | return $data; |
-
请 注册 或 登录 后发表评论