/* 提取所有图片 */
$content =file_get_content("url");
getImgs($content);
function getImgs($content, $order = 'all') {
$pattern = "/<img.*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern, $content, $match);
if (isset($match[1]) && !empty($match[1])) {
if ($order === 'all') {
return $match[1];
}
if (is_numeric($order) && isset($match[1][$order])) {
return $match[1][$order];
}
}
return '';
}
还没有人抢沙发呢~