正在显示
1 个修改的文件
包含
6 行增加
和
6 行删除
| @@ -181,12 +181,12 @@ class TranslateLogic extends BaseLogic | @@ -181,12 +181,12 @@ class TranslateLogic extends BaseLogic | ||
| 181 | $textContentArray = array_filter($matches[1], function($item) { | 181 | $textContentArray = array_filter($matches[1], function($item) { |
| 182 | return !empty(trim($item)); | 182 | return !empty(trim($item)); |
| 183 | }); | 183 | }); |
| 184 | -// $contentData = []; | ||
| 185 | -// foreach ($textContentArray as $v){ | ||
| 186 | -// $content = trim($v); | ||
| 187 | -// $trimmedString = preg_replace('/\s+/', ' ', $content); | ||
| 188 | -// $contentData[] = $trimmedString; | ||
| 189 | -// } | 184 | + $contentData = []; |
| 185 | + foreach ($textContentArray as $v){ | ||
| 186 | + $content = trim($v); | ||
| 187 | + $trimmedString = preg_replace('/\s+/', ' ', $content); | ||
| 188 | + $contentData[] = $trimmedString; | ||
| 189 | + } | ||
| 190 | $contentData = array_values($textContentArray); | 190 | $contentData = array_values($textContentArray); |
| 191 | $pattern = '/<meta\s+[^>]*name=[\'"](keywords|description)[\'"][^>]*content=[\'"]([^\'"]+)[\'"]>/i'; // 匹配 name 为 "keywords" 或 "description" 的 meta 标签的正则表达式 | 191 | $pattern = '/<meta\s+[^>]*name=[\'"](keywords|description)[\'"][^>]*content=[\'"]([^\'"]+)[\'"]>/i'; // 匹配 name 为 "keywords" 或 "description" 的 meta 标签的正则表达式 |
| 192 | $matches = array(); | 192 | $matches = array(); |
-
请 注册 或 登录 后发表评论