php如何正则过滤去掉html中指定标签内容?比如指定去掉所有标签为<p></p>的内容
网友回复
比如匹配html中的a标签,正则代码如下:
<?php $string="<html><a href='123.html'>链接1</a><a>链接2</a></html>"; preg_match_all( '/<a[^>]*(.*?)<\/a>/i', $string, $matches ); echo "<pre>"; print_r( $matches); echo '</pre>';