打开链接弹出下载框下载
<?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";
}