如何隐藏你的资源不让人知道他的位置,同时阻止一般菜鸟的下载,可以通过脚本输出指定 mime type 的流文件到浏览器上.
例如, 创建image.php, 操作已经存在的GIF图像
header('Content-type: image/gif'); // specified mime type
readfile($image_url); // output to the browser, either provide the resource url or relative path
exit(0);
readfile($image_url); // output to the browser, either provide the resource url or relative path
exit(0);
Content-type可以是任意资源,也包括js, css等
需要引用图片的时候:
<img src="image.php">
本文介绍了一种通过PHP脚本输出指定MIME类型流文件的方法来隐藏资源位置并阻止普通用户的下载行为。具体操作包括设置Content-type为所需的资源类型,并使用readfile()函数将资源输出到浏览器。

被折叠的 条评论
为什么被折叠?



