php导出内容到txt并自动弹出下载文件
in 后端 with 0 comment

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

in 后端 with 0 comment

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

<?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);
Comments are closed.