点击下载 使用文件流下载。注意设置:ContentType = "application/octet-stream" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不对吧,人家要下载的是个txt文件,怎么在txt文件里加http头啊楼主的问题我也遇到过,一般ie就可以正常下载,firfox就直接读取文件内容了一下,等高人指点 1.用php文件来间接下载txt2.改apache里关于txt的文件头 <?phpheader("Content-type: application/octet-stream");header("Content-disposition: attachment; filename=\"test.txt\"");?> header("content-type: application/file"); header("content-disposition: attachment; filename=\"test.txt\"");这个应该可以,我以前用过 问题已解决$file_name = basename($file);$handle = fopen($file,"r");header("Content-Type: application/force-download"); //强制下载header("Content-Disposition: attachment; filename=".basename($file_name)); //下载保存的文件名echo fread($handle,filesize($file));fclose($handle); 使用 Drupal 貌似 不需要懂 css, javascript, PHP? apache下htaccess配置rewrite规则不起作用 关于session和cookie php乱码问题 Zend Optimizer 不支持 apache 2.2 ??急 大家帮我看下这个哪里错了 谢谢 求一个正则与用法,最好能有个例子。在一个html文件中 把 email 提取出来,如何办? 请问这句SQL语句怎么写 ~~~~~~~~~~~~~~~~~~~~~ 关于exec? 一个很急的问题?如何删除和修改文章,? 数值型字段如何实现全部+1 想通过URL来传送一条带条件的select语句,怎么传呢?
2.改apache里关于txt的文件头
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=\"test.txt\"");
?>
header("content-disposition: attachment; filename=\"test.txt\"");这个应该可以,我以前用过
$file_name = basename($file);
$handle = fopen($file,"r");
header("Content-Type: application/force-download"); //强制下载
header("Content-Disposition: attachment; filename=".basename($file_name)); //下载保存的文件名
echo fread($handle,filesize($file));
fclose($handle);