PHP:文件下载不下载预期的文件

这个问题在这里已经有了答案:

  • 适用于PDF文件的MIME媒体类型3个答案

  • $filename = './images/upload/'.$mongoDbA['file'];
    
        $fileinfo = pathinfo($filename);
        $sendname = $fileinfo['filename'] . '.' . $fileinfo['extension'];
    
        header('Content-Type: application/pdf');
        header('Content-Disposition: attachment; filename="$sendname"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($filename));
        readfile($filename);
        exit;
    
    链接地址: http://www.djcxy.com/p/8173.html

    上一篇: PHP: File download doesnt download expected file

    下一篇: Why does JSON.stringify() accept Date objects?