PHP:文件下载不下载预期的文件
这个问题在这里已经有了答案:
$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