• 生成excel xls


    $filename = ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['guest_statistics']);

    header("Content-type: application/vnd.ms-excel; charset=utf-8");
    header("Content-Disposition: attachment; filename=$filename.xls");

    /* 生成会员购买率 */
    $data = $_LANG['percent_buy_member'] . " ";
    $data .= $_LANG['member_count'] . " " . $_LANG['order_member_count'] . " " .
    $_LANG['member_order_count'] . " " . $_LANG['percent_buy_member'] . " ";

    $data .= $user_num . " " . $have_order_usernum . " " .
    $user_all_order['order_num'] . " " . sprintf("%0.2f", ($user_num > 0 ? $have_order_usernum / $user_num : 0) * 100) . " ";

    /* 每会员平均订单数及购物额 */
    $data .= $_LANG['order_turnover_peruser'] . " ";

    $data .= $_LANG['member_sum'] . " " . $_LANG['average_member_order'] . " " .
    $_LANG['member_order_sum'] . " ";

    $ave_user_ordernum = $user_num > 0 ? sprintf("%0.2f", $user_all_order['order_num'] / $user_num) : 0;
    $ave_user_turnover = $user_num > 0 ? price_format($user_all_order['turnover'] / $user_num) : 0;

    $data .= price_format($user_all_order['turnover']) . " " . $ave_user_ordernum . " " . $ave_user_turnover . " ";

    /* 每会员平均订单数及购物额 */
    $data .= $_LANG['order_turnover_percus'] . " ";
    $data .= $_LANG['guest_member_orderamount'] . " " . $_LANG['guest_member_ordercount'] . " " .
    $_LANG['guest_order_sum'] . " ";

    $order_num = $guest_all_order['order_num'] > 0 ? price_format($guest_all_order['turnover'] / $guest_all_order['order_num']) : 0;
    $data .= price_format($guest_all_order['turnover']) . " " . $guest_all_order['order_num'] . " " .
    $order_num;

    echo ecs_iconv(EC_CHARSET, 'GB2312', $data) . " ";
    exit;
  • 相关阅读:
    pandas 查看行列数
    git提交代码至GitHub
    编码错误
    Pandas中根据列的值选取多行数据
    pandas过滤缺失数据之dropna()
    kail linux安装
    mybatis_plus插件使用
    Vue 插槽和自定义事件
    Vue计算属性
    使用axios 异步显示数据到页面
  • 原文地址:https://www.cnblogs.com/csjoz/p/7244062.html
Copyright © 2020-2023  润新知