header("Content-type: APPLICATION/OCTET-STREAM");
header("Content-Disposition: attachment; filename=文件名");
header("Content-Description: PHP3 Generated Data");

解决方案 »

  1.   

    老大,這個不行呀!你有沒有 測試過呀,我的機器 download 的 是一個 沒有 文件類型的 文件,裡邊是空
      

  2.   

    這個方法
         Header("Location:report03_doc/report03.doc");
    能不能在此基礎上解決呀
      

  3.   

    以下此段代码不管是什么类型文件,都直接下载!$query = "select * from project_attachment where id=$id";
    $result = MYSQL_QUERY($query);
    $size = MYSQL_RESULT($result,0,"file_size");
    $dname = MYSQL_RESULT($result,0,"file_name");
    $type="unknown/unknown";
    header("Content-length: $size");
    header("Content-type: $type");
    header( "Content-disposition: attachment; filename=$dname" );
    readfile("upload/".$dname);
      

  4.   

    在最前面加上
    <?php
    header("Content-type:application/vnd.ms-word");
    header("Content-Disposition:filename=test.doc");
    ?>
    注意要安装word
      

  5.   

    pokar(因为菜所以菜) 是对的