php隐藏图片真实地址代码怎么用
<?php
/**
* @modular 这个脚本将会隐藏图片的真实地址
* @param name string 图片名称
* @example <img src=" http://www.xxx.com/getImg.php?name=demo.jpg" />
* 等同于 <img src=" http://www.xxx.com/images/demo.jpg" />
*/
//设置图片真实地址所在的文件夹,您所帖的代码当中少了一个分号.程序会报错
$image_path="images/";
//从URL当中得到文件名.比方说本程序的名字为getImg.php,传入参数name=demo.jpg
//即URL地址为getImg.php?name=demo.jpg,
$image_file=$image_path.$_GET['name'];
//以只读模式打开文件
$sTmpVar = fread(fopen($image_file, 'r'), filesize($image_path));
//设置文件头显示为图片.
header("Content-type: image/* ");
//输出数据流
echo $sTmpVar;
?>