我做了一个PHP实现下载网页
但不明白为什么下载后OFFICE文件打开全是乱码,一直不知道怎么解决,以下是我的代码:请高手帮解决;
在此先谢谢了
$file_dir="upload_file/";
    $file_name = $file_name;
    if (file_exists($file_dir . $file_name))
     {
       $file   =   fopen($file_dir . $file_name, "r");   //打开文件//   输入文件标签   
       header("Content-type:   application/octet-stream;charset=ANSI");
       header("Content-type:   application/vnd.ms-powerpoint;charset=ANSI");
       header("Content-type:   application/vnd.ms-excel;charset=ANSI");
       header("Content-type:   application/msword;charset=ANSI");
   header("Content-Type:   text/html;charset=utf-8");    
   header("Accept-Ranges:   bytes");
       header("Accept-Length:   ".filesize($file_dir . $file_name));
       header("Content-Disposition: attachment;  filename=" . $file_name);//   输出文件内容
       echo   fread($file,filesize($file_dir . $file_name));
       fclose($file);      }
     else
     {
      die("文件找不到");
      }