作者 lyh

gx

@@ -314,6 +314,15 @@ class LoginController extends BaseController @@ -314,6 +314,15 @@ class LoginController extends BaseController
314 $strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容 314 $strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容
315 $pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式 315 $pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式
316 $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签 316 $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签
317 - var_dump($strippedContent); 317 + $pattern = '/<[^>]*>(.*?)<\/[^>]*>/'; // 定义匹配任意标签的正则表达式
  318 + $matches = array();
  319 + preg_match_all($pattern, $strippedContent, $matches);
  320 + $tagContentArray = array();
  321 + foreach ($matches[0] as $index => $tag) {
  322 + if ($matches[1][$index] != '') {
  323 + $tagContentArray[] = $matches[1][$index];
  324 + }
  325 + }
  326 + var_dump($tagContentArray);
318 } 327 }
319 } 328 }