正在显示
1 个修改的文件
包含
10 行增加
和
1 行删除
| @@ -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 | } |
-
请 注册 或 登录 后发表评论