php隐藏图片下载地址

版权声明:本文为博主原创文章,未经博主允许不得转载。更好的样式阅读体验可点击文章底部<<查看原文>> https://blog.csdn.net/huuinn/article/details/80150274

简介

有时根据图片url却不能下载图片。用php是如何实现的?

方法1

    public function test()
    {

        $img = "<img src='https://helpee.club/hoges/hoge2?f=minna.png'>";

        echo $img;

        $this->autoRender = false;

    }

方法2

    public function hoge2()
    {
        $file = $_GET['f'];

        $path = WWW_ROOT."img/".$file;
        header('Content-Disposition: inline; filename="' . $path . '"');

        //必要に応じ、png , jpg , gif などに変更
        header('Content-type: image/png');
        readfile($path);




        $this->autoRender = false;
    }


查看原文:https://www.huuinn.com/archives/610
更多技术干货:风匀坊
关注公众号:风匀坊

猜你喜欢

转载自blog.csdn.net/huuinn/article/details/80150274