一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php下载css中图片代码

时间:2011-09-26 编辑:简简单单 来源:一聚教程网

 代码如下 复制代码

php教程
$url = 'http://www.111com.net';
$data = file_get_contents('abc.css教程');
preg_match('/(.*//.*?)//',$url,$host);
$host = $host[1];
if (!is_dir('img')) { mkdir('img'); }
$regex = '/url('{0,1}"{0,1}(.*?)'{0,1}"{0,1})/';
preg_match_all($regex,$data,$result);
foreach ($result[1] as $val) {
if (preg_match('/^http.*/',$val)) { $target = $val; }
else if (preg_match('/^/.*/',$val)) { $target=$host.$val; }
else { $target=$url.$val; }
echo $target."
rn";
preg_match('/.*/(.*.D+)$/',$val,$name);
if (!is_file('./img/'.$name[1])) {
copy($target,'./img/'.$name[1]);
}
}?>

热门栏目