当我从android代码下载文件时,对我来说有效,但如果使用iPhone浏览器则不下载文件。
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$fileName.'".mp4');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
// header("Content-Type: video/mp4")
header('Content-Length: ' . filesize($filePath)); //Absolute URL
ob_clean();
flush();
readfile($filePath);