php导出内容到txt并自动弹出下载文件

最近有个项目需要用到,mark一下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/**
* Created by aaali.
* Date: 2017/12/13
* Time: 14:46
*/
$id=array('网址:xxx.com','用户名:xxx','密码:xxx',);
header("Content-type:application/octet-stream");
header("Accept-Ranges:bytes");
header("Content-Disposition:attachment;filename=".'测试文件.txt');
header("Expires:&nbsp;0");
header("Cache-Control:must-revalidate,post-check=0,pre-check=0");
header("Pragma:public");
echo implode("\n",$id);

php导出内容到txt并自动弹出下载文件

作者:有点东西

链接: https://www.youdiandongxi.com/article/php-download.html

协议:本文采用 CC BY-NC-SA 4.0 隐私协议,转载请注明出处!

评论区