<?php
$files = '<img src="http://img.phprm.com/img/bid_v2/bid_v2_content/p_bid.gif" alt="普通任务" /><img style="max-width:90%" height="60px" style="padding-top: 10px;" src="http://img.phprm.com/img/index_v3/20100611001.gif" alt="php把内容中图片连接地址替换成自己的 " >';
// 图片地址转换一下 $p=preg_replace('//image//', 'http://qq.ip138.com/image/', $pg[1]);
$reg = "/src\s*=\s*([\'|\"]?[^\s^\'^\"^>]+?[\'|\"]?)/iU";
$img = preg_match_all($reg, $files, $imgs);
for ($i = 0; $i < count($imgs[0]); $i++) {
$pic = trim($imgs[1][$i], '"'."'".' ');
echo $pic."<br>";
//保存图片
$opts = array(
'http' => array(
'header' => "referer: http://www.phprm.com/ "
)
);
}
Salin selepas log masuk