php隐藏图片下载地址

简介

有时根据图片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;
    }

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注