php下载txt文件

        $filename = 'abc.txt';
        $str = Auth::guard('admin')->id();
        header("Content-type: text/plain");
        header("Accept-Ranges: bytes");
        header("Content-Disposition: attachment; filename=".$filename);
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0" );
        header("Pragma: no-cache" );
        header("Expires: 0" );
        exit($str);  

  

 

posted @ 2020-08-13 14:51  ziyoujike  阅读(733)  评论(0)    收藏  举报