[英]How i can extract all html tags and there content from a string using php
我在字符串中有以下内容
<p class="link-pages">
LQ
<span class="page-link">Chapter 1</span>
<span class="page-link">Chapter 2</span>
<span class="page-link">Chapter 3</span>
<span class="page-link">Chapter 4</span>
</p>
现在使用正则表达式,我想提取所有内容和标签。 在php中是否有任何内置函数。
使用PHP的文档对象模型 , Simple HTML DOM , Ganon , phpQuery或任何其他可用的替代方法。
不要使用正则表达式来处理HTML。
最好您查看此答案和/或阅读解析The Cthulhu Way的HTML 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.