php实现文件下载,web端下载没问题,可是在手机端下载的文件内容竟然是当前html套php文件的内容,这是什么原因?
$path = IA_ROOT.'/'.$datum['file_path'];
$file_name = substr($datum['file_path'],strrpos($datum['file_path'],'/')+1);
// $file = fopen($path,"r"); // 打开文件
// $file_size=filesize($path);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$file_name);
header("Accept-ranges:bytes");
header('Content-Transfer-Encoding: binary');
readfile($path);