[英]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.