PHP 下载txt文件 功能

来源:互联网 发布:淘宝上二手4s能买吗 编辑:程序博客网 时间:2024/04/26 04:09
$filename = $file; //文件路径        $mime = 'application/force-download';        header('Pragma: public');        header('Expires: 0');        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');        header('Cache-Control: private',false);        header('Content-Type: '.$mime);        header('Content-Disposition: attachment; filename="'.basename($filename).'"');        header('Content-Transfer-Encoding: binary');        header('Connection: close');        readfile($filename);        exit();

0 0
原创粉丝点击