复制代码 代码如下:
$domain ='http://www.jb51.net';
$url = '/newskin/images/v4/logo.jpg';
$pats = pathinfo($url);
$dir = '.'.$pats['dirname'].'/';
if(!is_dir($dir))
{
@mkdirs($dir, 0777);
@fclose(fopen($dir.'/index.htm', 'w'));
}
$img = file_get_contents($domain.$url);
file_put_contents('.'.$url,$img);
echo '
';
function mkdirs($pathname, $mode = 0755){
is_dir(dirname($pathname)) || mkdirs(dirname($pathname), $mode);
return is_dir($pathname) || @mkdir($pathname, $mode);
}
?>
http://www.bkjia.com/PHPjc/825295.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/825295.htmlTechArticle复制代码 代码如下: ?php $domain ='http://www.jb51.net'; $url = '/newskin/images/v4/logo.jpg'; $pats = pathinfo($url); $dir = '.'.$pats['dirname'].'/'; if(!is_dir($dir)) { @...