• txt文件下载


    $content = '订购日志明细:'.$begin_date.'至'.$end_date;

    if ($detail_list) {
    foreach ($detail_list as $detail) {
    $content .= '手机号:'.$detail['MSISDN'];
    $content .= ' 归属地:全国';
    $content .= ' 歌曲名称:'.$detail['CONTENT_NAME'];
    $content .= ' 业务ID:'.$detail['CONTENT_ID'];

    $biz_type = isset($bussiness_list[$detail['BIZ_TYPE']]) ? (($detail['BIZ_TYPE'] == '02' && $detail['FEE_TYPE'] == '03') ? '开通包月业务' : $bussiness_list[$detail['BIZ_TYPE']]) :'';
    $content .= ' 业务类型:'.$biz_type;
    $biz_type = '';

    $content .= ' 计费触发时间:'.timeStrToDate($detail['TIME_STAMP']);
    $content .= ' 价格(单位:分):'.timeStrToDate($detail['PRICE']);
    }
    }

    $filename = 'logDetil.txt';
    $this->downTxt($filename);
    echo $content;
    $content = '';

    /**
    * 下载文本文件
    */
    function downTxt($filename) {
    header("Content-Type: application/force-download");
    header("Content-Type: application/download");
    header("Content-Transfer-Encoding: binary");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Pragma: no-cache");

    Header("Content-type: application/octet-stream");
    Header("Accept-Ranges: bytes");
    Header("Accept-Length: ".filesize($filename). ' bytes');

    Header('Content-Disposition: attachment; filename='.$filename);
    }

    换行的话用"\r\n",必须是双引号才能解析。

  • 相关阅读:
    手写编译器之词法分析器一
    手写编译器之前
    PAT(A) 1005. Spell It Right (20)
    PAT(A) 1001. A+B Format (20)
    PAT(A) 1073. Scientific Notation (20)
    PAT(A) 1061. Dating (20)
    PAT(A) 1058. A+B in Hogwarts (20)
    PAT(A) 1027. Colors in Mars (20)
    PAT(A) 1019. General Palindromic Number (20)
    PAT(A) 1031. Hello World for U (20)
  • 原文地址:https://www.cnblogs.com/xingmeng/p/3023607.html
Copyright © 2020-2023  润新知