作者 lyh

gx

... ... @@ -314,11 +314,9 @@ class LoginController extends BaseController
$strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容
$pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式
$strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签
var_dump($strippedContent);
die();
$pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式
$matches = array();
preg_match_all($pattern, $content, $matches);
preg_match_all($pattern, $strippedContent, $matches);
$textContentArray = array_filter($matches[1], function($item) {
return !empty(trim($item));
});
... ...