微擎使用excel导出

$list = pdo_fetchall($sql_list,$params);

if ($_GPC['export'] == 1) {
    foreach ($list as &$row) {
        $row['createtime'] = date('Y-m-d H:i', $row['createtime']);
    }


    unset($row);
    $columns = array(
        array(
            'title' => '编号',                         //excel标题
            'field' => 'logno',                      //excel内容
            'width' => 12                           //excel宽度
        ),
        array(
            'title' =>'时间',                          //excel标题
            'field' => 'createtime',              //excel内容
            'width' => 12                           //excel宽度
        )
    );
    
    m('excel')->export($list , array(
        "title" => (empty($type) ? "会员奖金数据-" : "会员奖金记录") . date('Y-m-d-H-i', time()),
        "columns" => $columns
    ));
}
 

猜你喜欢

转载自blog.csdn.net/weixin_42637737/article/details/88642250