PHP中用header:图片地址 简单隐藏图片源地址

PHP代码
  1. <?php      
  2. $path=$_GET["path"];      
  3. $cacheimgname=str_replace("/","_",$path);      
  4. $localimg="upimg/".$cacheimgname;      
  5. if ((file_exists($localimg)))      
  6. {      
  7. $httpurl=$localimg;      
  8. }      
  9. else     
  10. {      
  11. $httpurl="http://www.imageserver.com/".$path;      
  12. @copy($httpurl,$localimg);//缓存图片!      
  13. }      
  14. header("Locationhttpurl");      
  15. exit;      
  16. ?>    

调用它类似这样:

 

 

PHP代码
  1. <img src="img.php?path=x/x/xtest.gif">    
posted @ 2007-12-03 18:08  二宝的博客  阅读(168)  评论(0编辑  收藏  举报