php中file_get_contents的图片乱码

        // https://packagist.org/packages/endroid/qr-code#2.x-dev
        $qrCode = new QrCode('http://www.baidu.com');
        $qrCode->setSize(100);
        $qrCode->setEncoding('UTF-8');
        header('Content-Type: ' . $qrCode->getContentType());
        echo $qrCode->writeString();
        die; #不能少否则乱码
原文地址:https://www.cnblogs.com/chengfengchi/p/13864240.html