background image
header('Content-Disposition: attachment; filename="'
. $filename . '.xls"');
}
header("Pragma: no-cache");
header("Expires: 0");
$dates_excel = $dao->getTongjiInfo($kaoheCode);
$mytime = date("Y-m-d H:i:s",$dates_excel['KH_TIME']);
$excel=new SimpleExcel();//调用类开始
$excel->excelItem(array("统计时间",$mytime));//第一行标
题,可以不要
$excel->excelItem(array("序号","姓 名","部门","分
数"));//第一行标题,可以不要
$excel->colsAttrib(array("1","a","a","1"));//定义属性,数
字型为"1",字符型为"a"
$scores = explode(',',$dates_excel['KH_SCORES']);
//echo $scores;exit();
$i=0;
foreach ($scores as $v){
$i++;
$r = explode(':', $v);
$userCode = $r[0];
$user = $dao->getUserInfo($userCode);
$dept=$dao->getCellName($userCode);
$excel->excelWrite(array($i,$user['QT_NAME'],$dept,$
r[1]));
}
$excel->excelEnd();
}
------------------------------------------------------
php 导出 Excel php
<?
/**
* 以下是使用示例,对于以 //// 开头的行是不同的可选方式,请根据实际需
* 打开对应行的注释。