这是我实现下载功能的代码,下载时弹出的对话框上面  文件的大小只是2个字节,下载下来的全是乱码,这是怎么回事,帮忙解决
<?php 
  if($_GET['id']){
   $id=$_GET['id'];
   //echo"$id"; $query_1=mysql_query("select * from tb_zl where id=$id",$conn);
while($myrow_1=mysql_fetch_array($query_1)){
     
    $path="$myrow_1[path]";//下载到目录下
                              
  
header("Content-type: text/html; charset=gb2312"); //设置文件编码格式
if(!empty($path) and !is_null($path)){ //判断变量是否为空,是否为NULL
$filename=basename($path); //获取文件名
$file=@fopen($path,"r");
if($file){
header("Content-type:application/octet-stream");  //输出MIME类型 
header("Content-type:application/vnd.ms_excel");
header("Content-type:application/msword");
header("Content-type:application/zip");
header("Accept-ranges:bytes"); //接受的范围单位
header("Accept-length:".filesize($path)); // 文件长度 
header("Content-Disposition:attachment;filename=".$filename);  //缺省时文件保存对话框中的文件名 fread($file,filesize($path)); //读取文件
fclose($file); //关闭文件
exit; //退出
}
else{
echo "<script>alert('您下载的文件不存在!'); history.back();</script>";
}
}
}
}
?>