我从 DB 得到这个 HTML 字符串:-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex</p><img class="classname" alt="alttext" src="http://www.domain.com/uploads/myimage.jpg" width="612" height="612" /><p>Going by the Itinerary, we will be at the official launch on the 22nd May.</p><img class="classname" alt="alttext" src="http://www.domain.com/uploads/myimage1.jpg" width="612" height="612" />
如您所见,在字符串中有两个图像标签。我想获得第一个图像标签的来源,例如:-
http://www.domain.com/uploads/myimage.jpg
谁能建议我如何从 html 字符串中获取此文本。
提前致谢