<?php
$p = '/<img .*?src=[\'|\"](.+?)[\'|\"].*? alt="PHP code to extract the first picture on the page as a thumbnail" >/i';
preg_match_all($p,$str,$match);
print_r($match[1][0]);
?>
<img alt="PHP code to extract the first picture on the page as a thumbnail"http://usr.im/200x60?bg=3498DB&text=tool.lu" class="img" />
结果为:http://usr.im/200x60?bg=3498DB&text=tool.lu
<img alt="PHP code to extract the first picture on the page as a thumbnail"http://img.mukewang.com/user/55c877240001291602790279-80-80.jpg" class="img" />
结果为:http://img.mukewang.com/user/55c877240001291602790279-80-80.jpg
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn