【发布时间】:2011-01-12 01:47:16
【问题描述】:
我有一个脚本,它在名为 $content 的变量中返回以下内容
<body>
<p><span class=\"c-sc\">dgdfgdf</span></p>
</body>
然而,我需要将body标签之间的所有内容放在一个名为matches的数组中
我做了以下来匹配body标签之间的东西
preg_match('/<body>(.*)<\/body>/',$content,$matches);
但是 $mathces 数组是空的,我怎样才能让它返回 body 标签内的所有内容
【问题讨论】:
-
查看有关使用正则表达式解析 html 的说明:stackoverflow.com/questions/1732348/…
标签: php regex html-parsing