关于preg_match_all的抓取
<div><br /> <h1>标题1</h1><br /> <p>内容1</p><br /> <p>内容2</p><br /> <h1>标题2</h1><br /> <p>内容1</p><br /> <p>内容2</p><br /> <p>内容3</p><br /> <p>内容4</p><br /> <h1>标题3</h1><br /> <p>内容1</p><br /> <p>内容2</p><br /> <p>内容3</p><br /> </div>
内容1
内容2
内容1
内容2
内容3
内容4
内容1
内容2
内容3
preg_match_all('/<h1>[\w\W]*<(h1|\/div)/U',$html, $out)
preg_match_all('/<div>(.*)<\/div>/is', $str, $m);<br /> $m = explode('<h1>', substr($m[1][0], 5));<br /> foreach($m as $x)<br /> echo htmlspecialchars ("<h1>$x") . '<br/>';
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号