解决PHP在IE中下载文件,中文文件名乱码问题
if( stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE')!==false )
$filename = urlencode( $filename );
// 输入文件标签
Header("Content-Type: application/vnd.android.package-archive");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($file_path));
Header("Content-Disposition: attachment; filename=" . $filename );
// 输出文件内容
echo fread($file,filesize($file_path));
fclose($file);
如果当前浏览器是ie, 需要对包含中文的文件名进行urlencode编码