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

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

<?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">  

相关文章

php目录管理函数小结

chdir : 改变目录。 dir : 目录类别类。 closedir : 关闭目录 handle。 opendir : 打开目录 handle。 readdir : 读取目录 hand...

php数组函数array_key_exists()小结

array_key_exists()函数判断某个数组中是否存在指定的key,如果key存在,则返回true,否则返回flase array_key_exists(key,array);...

php实现数组中出现次数超过一半的数字的统计方法

数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。由于数字2在数组中出现了5次,超过数组长度的一半,因此输出...

php给图片添加文字水印方法汇总

1: 面向过程的编写方法 //指定图片路径 $src = '001.png'; //获取图片信息 $info = getimagesize($src); //获取图片扩展名 $typ...

PHP INT类型在内存中占字节详解

PHP INT类型在内存中占字节详解

本教程将介绍输出INT类型在内存中占多少个字节 新建一个333.php,如图所示: 添加php的界定符(<?php?>),如图所示: 声明PHP与浏览器交...