注册 登录
编程论坛 PHP技术论坛

打开链接弹出下载框下载

wa2531483 发布于 2013-12-24 10:40, 1842 次点击
<?php
header("Content-type:application/vnd.ms-excel");
header('Content-type: charset=GBK');
header('Pragma: no-cache');
HEADER('Expires: 0');
//以年月日时间命名
header("Content-Disposition:filename=".date("Ymd",time()).".xls");
echo "Name\t";
echo "math \t";
echo "Chinese\t";
echo "English \t";
echo "Sum\t\r\n";
$arr=array(
        0=>array('zhangsan',12,23,45),
        1=>array('lisi',23,32,89),
        2=>array('wangwu',78,54,90),
        3=>array('gouliu',23,32,89),
        );
//数组中单元个数
$c=count($arr);
for($i=0;$i<$c;$i++){
        echo $arr[$i][0]."\t";
        echo $arr[$i][1]."\t";
        echo $arr[$i][2]."\t";
        echo $arr[$i][3]."\t";
        echo array_sum($arr[$i])."\t\r\n";
    }
0 回复
1