来源: 互联网 日期: 2020-07-13 20:30:01
一般来说,下载txt会直接打开,把下面的代码放入到下载页面中,就提示下载并可以进度保存了!文件位置(\e\DownSys\class\DownSysFun.php)
找到如下代码(帝国CMS7.5 大概203行左右)
//下载
Header("Content-type: application/octet-stream");
//Header("Accept-Ranges: bytes");
//Header("Accept-Length: ".$filesize);
Header("Content-Disposition: attachment; filename=".$filename);
echo ReadFiletext($file);
改成如下代码:(注意UTF8编码请用编辑器打开修改) //下载 $filesize = filesize($file); Header('Pragma: public'); Header('Last-Modified:'.gmdate('D, d M Y H:i:s') . ' GMT'); Header('Cache-Control: no-store, no-cache, must-revalidate'); Header('Cache-Control: pre-check=0, post-check=0, max-age=0'); Header('Content-Transfer-Encoding: binary'); Header('Content-Encoding: none'); Header("Content-type: application/octet-stream"); Header("Content-Disposition: attachment; filename=".$filename); Header('Content-length: '.$filesize); echo ReadFile($file);