<a href="www.xxx.com/download/yy.(txt or doc or xls)"></a>
ie自动会下载的如果你装有flashget 或其他下载软件,他会连接到这些软件,来下载

解决方案 »

  1.   

    file = fopen($file_dir . $file_name,"r"); // 打开文件 
    // 输入文件标签
    Header("Content-type: application/octet-stream");
    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);
    exit;
      

  2.   

    Header("Content-type: application/octet-stream");
    Header("Accept-Ranges: bytes");
    Header("Accept-Length: ".filesize($file_dir . $file_name));
    Header("Content-Disposition: attachment; filename=" . $file_name);
    这些都是什么意思啊 能给个完整的说明吗?除了上面的类型,还有别的其他类型吗?
      

  3.   

    $file = fopen($file_dir . $file_name,"r"); // 打开文件
    // 输入文件标签
    Header("Content-type: application/octet-stream");
    Header("Accept-Ranges: bytes");
    Header("Accept-Length: ".filesize($file_dir . $file_name));
    Header("Content-Disposition: attachment; filename=" . $file_name);
    // 输出文件内容
    fread($file,filesize($file_dir . $file_name));
    fclose($file);
    exit;我的文件是excel文件,怎么回事啊
    这样生成的结果是:
    Warning: Cannot add header information - headers already sent by (output started at c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php:10) in c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php on line 223Warning: Cannot add header information - headers already sent by (output started at c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php:10) in c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php on line 224Warning: Cannot add header information - headers already sent by (output started at c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php:10) in c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php on line 225Warning: Cannot add header information - headers already sent by (output started at c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php:10) in c:\Program Files\Apache Group\Apache\htdocs\hcycom\host\grid.php on line 226
    邢唷?>? !??  ???\pJava Excel API BRa=??=h\:?8X@"?1?Arial1?Arial1?Arial1?Arial? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @ ? @  @ +? @ )? @ ,? @ *? @  ? @ ?€?€?€?€?€?€`? first sheet,? ?? >%  d褚MbP?_*+€%?"d,,??U>      鰁魰CPU峿弴s/2003-09-10 13:45:071.2%/2003-09-10 13:55:071.2%/2003-09-10 14:05:073.0%/2003-09-10 14:15:071.2%/2003-09-10 14:25:071.2%/2003-09-10 14:35:071.2%/2003-09-10 14:45:071.2%/2003-09-10 14:55:071.2%/ 2003-09-10 15:05:07 2.8%/ 2003-09-10 15:15:07 1.2%/ 2003-09-10 15:25:07 1.2%/ 2003-09-10 15:35:07 1.2%/ 2003-09-10 15:45:07 1.2%/2003-09-10 15:55:071.2%/2003-09-10 16:05:072.8%/2003-09-10 16:15:071.2%/2003-09-10 16:25:071.2%/2003-09-10 16:35:071.2%/2003-09-10 16:45:071.2%/2003-09-10 16:55:071.2%/2003-09-10 17:05:072.0%/2003-09-10 17:15:071.2%/2003-09-10 17:25:071.2%/2003-09-10 17:35:071.4%/2003-09-10 17:45:081.2%/2003-09-10 17:55:071.2%/2003-09-10 18:05:072.8%/2003-09-10 18:15:071.2%/2003-09-10 18:25:071.2%/2003-09-11 08:25:071.4%/2003-09-11 08:35:071.6%Db l*HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH !"#$%&'()*+,-./0123456789:;<=/ 2003-09-11 08:45:07 1.4%/!2003-09-11 08:55:07!1.6%/"2003-09-11 09:05:07"2.0%/#2003-09-11 09:15:07#1.4%/$2003-09-11 09:25:07$1.4%/%2003-09-11 09:35:07%1.6%/&2003-09-11 09:45:07&1.4%/'2003-09-11 09:55:07'1.2%/(2003-09-11 10:05:07(2.2%/)2003-09-11 10:15:07)1.2%/*2003-09-11 10:25:07*1.2%/+2003-09-11 10:35:07+1.8%/,2003-09-11 10:45:07,
      

  4.   

    如果有足够多的权限的话,修改服务器的配置是一个方法(如是apache服务器的话,修改httpd.conf)能解决问题