• 首页
  • 数据库
    • mysql
  • web服务器
    • nginx
    • Apache
  • 操作系统
    • Centos
    • Debian
    • Ubuntu
    • mac
    • windows
  • 编程语言
    • html
    • php
  • 集群
    • mycat
  • 其它
欢迎光顾我的个人博客
  1. 首页
  2. 文章
  3. 编程语言
  4. php
  5. 正文

PHP实现页面图片跳转技术

2020年05月30日 1121点热度 0人点赞 0条评论

和其它语言实现的一样,采用路径伪装实现。

原理:

新建与图片一样文件名的文件夹,并在这个文件夹下放置一个跳转的实现文件,这个文件的功能是实现跳转或是载入图片

路径结构

1.jpg/index.php

img/1.jpg

index.php文件源码

<?php
    /*
     * 当直接输入路径访问图片时,跳转
    */
    if($_SERVER['HTTP_REFERER'] != ''){
        if(is_file('../img/1.jpg')){
            header("Content-type: attachment");
            header("Content-Disposition: inline; filename=/"000.jpg/"");
            $fp = fopen('../img/1.jpg', "r");
            $contents = fread($fp, filesize ('../img/1.jpg'));
            echo $contents;
            $splitString = str_split($contents, 8192);
            var_dump($contents);
            //foreach($splitString as $chunk)
                //echo $chunk;

        }
    }else{
        header('location:http://163.com');
    }
?>

不管用什么语言实现起来都是简单的

标签: php
最后更新:2020年06月03日

多洛夫

多看多想多研究,总会有创新

点赞
< 上一篇
下一篇 >

文章评论

取消回复

多洛夫

多看多想多研究,总会有创新

博客更新日期
2025 年 6 月
一 二 三 四 五 六 日
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« 7 月    
分类
标签聚合
centos php 域名邮箱 mac ffmpeg lls mysql Photoshop 图片格式转换 DNS Shell 视频截图 谷歌浏览器插件 Launchctl Yandex google插件 Google Termux wordpress haproxy

© 2020 多洛夫