复制代码 代码如下:
<?php
$path=$_get["path"];
$cacheimgname=str_replace("/","_",$path);
$localimg="upimg/".$cacheimgname;
if ((file_exists($localimg)))
{
$httpurl=$localimg;
}
else
{
$httpurl="http://www.imageserver.com/".$path;
@copy($httpurl,$localimg);//缓存图片!
}
header("locationhttpurl");
exit;
?>
调用它类似这样:
复制代码 代码如下:
<img src="img.php?path=x/x/xtest.gif">
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!