帝国CMS强制下载txt文件浏览器带下载进度
2018-03-26 站长 站长日志
一般来说,下载txt会直接打开,把下面的代码放入到下载页面中,就不会了!
//下载$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);