时间:2021-07-01 10:21:17 帮助过:20人阅读
代码如下:
include '../common.inc.php';
$token = $_POST['token'];
if(GToken::isToken($token,'REPORT')){
$names = $_POST['name'];
$birthdays = $_POST['birthday'];
$phones = $_POST['phone'];
$sexs = $_POST['sex'];
$emails = $_POST['email'];
$scoreAs = $_POST['scoreA'];
$scoreBs = $_POST['scoreB'];
$scoreCs = $_POST['scoreC'];
$list = array();
$score = array();
for($i=0;$i
'name' => $names[$i],
'sexs' => $sexs[$i],
'birthday' => $birthdays[$i],
'email' => $emails[$i],
'phone' => $phones[$i]
);
array_push($list,$arr);
unset($arr);
$arr = array(
'name' => $names[$i],
'scoreA' => $scoreAs[$i],
'scoreB' => $scoreBs[$i],
'scoreC' => $scoreCs[$i]
);
array_push($score,$arr);
unset($arr);
}
include '../lib/smarty/Smarty.class.php';
$gmt = GSmarty::getInstance('test');
$gmt->assign_by_ref("list",$list);
$gmt->assign_by_ref('score',$score);
header("Cache-Control: public");
header('content-type:application/vnd.ms-excel');
header("Content-Disposition:attachment; filename=report.xls");
$gmt->display('report');
}
?>
以上就介绍了shimokita glory days PHP Smarty生成EXCEL文档的代码,包括了shimokita glory days方面的内容,希望对PHP教程有兴趣的朋友有所帮助。