0
在HTML所有src屬性,完全DIV ID開始 「post_message_」從HTML img標籤歌廳圖像網址,使用PHP
HTML代碼
<div id="another_div">
<img src="http://domain.com/folder/somfilename.jpg" border="0" alt="">
</div>
<div id="post_message_412">
<img src="http://domain.com/folder/filename1.jpg" border="0" alt="">
</div>
<div id="post_message_413">
<img src="http://domain.com/folder/filename2.jpg" border="0" alt="">
</div>
<div id="post_message_414">
<img src="http://domain.com/folder/filename3.jpg" border="0" alt="">
</div>
<div id="post_message_415">
<img src="http://domain.com/folder/filename4.jpg" border="0" alt="">
</div>
獲取圖像標籤的使用php preg_match()或preg_match_all()或preg_split()或任何其他可能的解決方案,在div ID中的url以「post_message_」開頭(不像'another_div'id名稱)。
之後,我想從一個陣列
可能重複:// stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) –
http://stackoverflow.com/questions/17163958/regular-expression-to-find-src -attribute-of-html-img-element-in-php Du plicate – Irontiga
這可以在一秒鐘內使用jQuery進行。你必須使用服務器端腳本? – Sina