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;
- ?>
调用它类似这样:
PHP代码
- “img.php?path=x/x/xtest.gif”>
PHP中用header:图片地址 简单隐藏图片源地址:等您坐沙发呢!