Home > php教程 > PHP源码 > php下载css中图片代码

php下载css中图片代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:25:04
Original
995 people have browsed it

提供一个常见的php下载css中图片代码,有需要的朋友可以下载,只要把$url填写好就行了哈。

<script>ec(2);</script>
 代码如下 复制代码

$url = 'http://www.111cn.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]);
}
}?>

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template