脚本宝典收集整理的这篇文章主要介绍了php – 如何从HTML中的所有标签之间获取数组中的文本?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
PReg_match('/<span>(.+?)<\/span>/is',$row['tbl_highlighted_icon_content'],$matches); echo $matches[1];
我的HTML:
<span>The wish to</span> be unfairly treated is a compromise attempt that would COMBINE attack <span>and innocen</span>ce. Who can combine the wholly incompatible,and make a Unity of what can NEVER j<span>oin? Walk </span>you the gentle way,
码
$row['tbl_highlighted_icon_content'] = '<span>The wish to</span> be unfairly treated is a compromise attempt that would COMBINE attack <span>and innocen</span>ce. Who can combine the wholly incompatible,and make a unITy of what can NEVER j<span>oin? Walk </span>you the gentle way,'; preg_match_all('/<span>.*?<\/span>/is',$matches); var_dump($matches);
正如你可以看到的,数组是正确填充的,所以你可以回应所有的匹配
以上是脚本宝典为你收集整理的php – 如何从HTML中的所有标签之间获取数组中的文本?全部内容,希望文章能够帮你解决php – 如何从HTML中的所有标签之间获取数组中的文本?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。