比较恶心的360老年版浏览器 文件导出下载

编程入门 行业动态 更新时间:2024-10-23 23:21:05

比较恶心的360<a href=https://www.elefans.com/category/jswz/34/1730193.html style=老年版浏览器 文件导出下载"/>

比较恶心的360老年版浏览器 文件导出下载

function export_txt($data)
{   Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); $destination_folder='./Public/file/';       //txt文件  $file_name=iconv('utf-8', 'gbk', '账号卡信息').date('Y-m-d H-i-s',time()).'.txt';       $destination = $destination_folder.$file_name; //新excel路径$fp_write = fopen($destination,"w");chmod($destination,0777);$row = "序号\t卡号\t卡密码\t生成日期\t有效期(天)\t充值期限\t金额\r\n";fwrite($fp_write,$row);$i=1;foreach ($data as $key => $value) { $row = "$i\t{$value['cardnum']}\t{$value['cardpwd']}\t{$value['createtime']}\t{$value['validityday']}\t".date('Y-m-d',$value['expirydate'])."\t{$value['money']}\r\n"; fwrite($fp_write,$row);//echo $row;$i++;}  fclose($fp_write);        $file_sub_path="./Public/file/";$file_path=$file_sub_path.$file_name; $fp=fopen($file_path,"r"); $file_size=filesize($file_path);//下载文件需要用到的头        $useragent = $_SERVER['HTTP_USER_AGENT'];// echo $useragent;
// 输出 Content-Disposition时候比较恶心的 还要区分大小写
if(strstr($useragent,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)")){$dis="Content-Disposition:attachment;filename='".$file_name."'";}else{$dis='Content-Disposition:attachment;filename="'.$file_name.'"';}Header($dis); Header("Accept-Length:".$file_size); $buffer=1024; $file_count=0; while(!feof($fp) && $file_count<$file_size){ $file_con=fread($fp,$buffer); $file_count+=$buffer; echo $file_con; } fclose($fp); exit(); }

 


 

更多推荐

比较恶心的360老年版浏览器 文件导出下载

本文发布于:2024-02-27 17:12:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1707492.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:老年   浏览器   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!