当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP中用header图片地址 简单隐藏图片源地址

PHP
include()与require()的对比
php和asp对象的等价关系
PHP, JScript 和 VBScript 函数和类的语法
PHP:MVC迷思
PHP脚本的8个技巧(1)
PHP脚本的8个技巧(2)
PHP脚本的8个技巧(3)
PHP脚本的8个技巧(4)
PHP脚本的8个技巧(5)
PHP脚本的8个技巧(6)
PHP脚本的8个技巧(7)
PHP脚本的8个技巧(8)
PHP教程.经验技巧(上)
递归列出所有文件和目录
PHP的历史和优缺点
PHP下MAIL的另一解决方案
PHP文本数据库的搜索方法
PHP调用三种数据库的方法(1)
PHP调用三种数据库的方法(2)
PHP调用三种数据库的方法(3)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 193 ::
收藏到网摘: n/a

用header实现图片地址的隐藏
复制代码 代码如下:

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