function download($file_path,$file_name){
$file_name = iconv("UTF-8","GB2312",$file_name);
$file = $file_path.$file_name;
if(!file_exists($file)){
echo "该文件不存在";
die();
}
$filesize = filesize($file);
$fp = fopen($file,"r");
//返回的文件
header("Content-type: application/octet-stream");
//按照字节大小返回
header("Accept-Ranges: bytes");
//返回文件大小
header("Accept-Length: $filesize");
//这里客户端的弹出对话框,对应的文件名
header("Content-Disposition: attachment; filename=".$file_name);
$buffer = 1024;
$count = 0;
while(!feof($fp) || ($count< $filesize)){
$data = fread($fp,$buffer);
$count+=$buffer;
echo $data;
}
fclose($fp);
}