1. 二宝博客首页
  2. php

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

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

调用它类似这样:

 

 

PHP代码
  1. “img.php?path=x/x/xtest.gif”>    
]]>

原创文章,作者:键盘游走者,如若转载,请注明出处:https://www.708034.com/2007/12/php%e4%b8%ad%e7%94%a8header%e5%9b%be%e7%89%87%e5%9c%b0%e5%9d%80-%e7%ae%80%e5%8d%95%e9%9a%90%e8%97%8f%e5%9b%be%e7%89%87%e6%ba%90%e5%9c%b0%e5%9d%80/

发表评论

电子邮件地址不会被公开。 必填项已用*标注