求php正则匹配table标签

table里面所有的内容都不要过滤掉,包括标签和内容。

<table id="Table1" class="blacktab" bordercolor="Black" border="0" width="100%">

//内容

</table>
阅读 7.8k
3 个回答
preg_match("/<table[^>]*?>(.*?)<\/table>/s",$html,$match);

print_r($match[1]);
<?php
$s = file_get_contents('./table.html');
preg_match('/<table[^>]*>(.*)<\/table>/is', $s, $arMatch);
var_export($arMatch);
?>
preg_match('/<table.*?>(.*?)<\/table>/s',$str,$match);
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题