2014-09-22 123 views
0
<strong><a href="http://www.flickr.com/photos/therevsteve/5152424274/sizes/l/"> 
<img src="http://www.brightknowledge.org/knowledge-bank/teaching/teaching-in-private- schools/@@images/77cbbd71-bbf5-4fb6-a017-cc61016b6f60.jpeg" alt="Teaching in private schools" class="image-right" title="Photo by Steve Day" /></a> 
There are big differences between teaching in independent and state schools. Find out about the most important ones here.</strong><img src="http://www.brightknowledge.org/++resource++brightside.theme.images/badge.png" /> 

這裏是我的HTML.I能夠一個接一個地獲取img標籤。HTML中有多個img標籤。如何使用PHP獲取這些img標籤?如何從html中使用php獲取多個img標籤?

+0

你是從獲取這些標籤試試? – Khushboo 2014-09-22 07:41:43

+0

你的意思是你想用PHP獲得所有的DOM標籤嗎? – 2014-09-22 08:10:47

回答

0

您可以使用XPath查詢所有img節點。

The DOMXPath class 在頁面底部有一個很好的樣本。

0

你可以用這個

preg_match_all('/<img[^>]+>/i',$html, $allTags); 

print_r($allTags);