我要下载所有格式(图像,视频,音频,PDF,文本和所有Microsoft Office文档类型)而不会出现错误,我是否应该指定MIME类型?
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private',false);
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename='.$fileName);
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($filePath));
header('Connection: close');
readfile($filePath);
exit () ;