PHP中用header图片地址简单隐藏图片源地址_PHP教程
时间:2021-07-01 10:21:17
帮助过:2人阅读
代码如下:
$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;
?>
调用它类似这样:
代码如下:
http://www.bkjia.com/PHPjc/318905.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318905.htmlTechArticle 代码如下:?php $path=$_GET["path"]; $cacheimgname=str_replace("/","_",$path); $localimg="upimg/".$cacheimgname; if((file_exists($localimg))) { $httpurl=$localimg;...