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