PHP不使用phpexcel导出

释放双眼,带上耳机,听听看~!

当前方式不能支持合并单元格等高级操作,只支持最简单的

    $filename = ’excel名称‘;
    $title = array('column_name1,column_name2,column_name3');
    $data = array(
        array(111,222,333),
        array(444,555,666),
        array(777,888,999),
    )
    $filename=iconv("UTF-8", "GB2312",$filename);
    header("Content-type:application/octet-stream");
    header("Accept-Ranges:bytes");
    header("Content-type:application/vnd.ms-excel");  
    header("Content-Disposition:attachment;filename=".$filename.".xls");
    header("Pragma: no-cache");
    header("Expires: 0");
    //导出xls 开始
    if (!empty($title)){
        foreach ($title as $k => $v) {
            $title[$k]=iconv("UTF-8", "GB2312",$v);
        }
        $title= implode("/t", $title);
        echo "$title/n";
    }
    if (!empty($data)){
        foreach($data as $key=>$val){
            foreach ($val as $ck => $cv) {
                $data[$key][$ck]=iconv("UTF-8", "GB2312", $cv);
            }
            $data[$key]=implode("/t", $data[$key]);
        }
        echo implode("/n",$data);
    }

【转自慕课】https://www.imooc.com

PHP

无限级分类三个重要的功能

2022-3-3 18:26:32

PHP

压力测试工具ab的两个Time per request 参数含义和区别

2022-3-3 18:27:03

搜索