header ('Content-type:application/vnd.ms-excel'); header('Content-Disposition:filename=报名信息.xls'); $header = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><title>报名信息</title><style>th{text-align;center;font-weight:bold;}</style></head><body><table width=\"100%\" border=\"1\"><tr>"; //标题栏 /* foreach($set AS $k=>$v){ $header .= '<th width="150">'.$v['name'].'</th>'; } */ $header .= "</tr>"; //各类数值 /* foreach($user AS $i=>$r){ $main .= '<tr><td>'.$u['nickname'].'</td>'; foreach($data AS $n=>$m){ $main .= '<td>'.$m['value'].'</td>'; } $main .= '</tr>'; } */ $footer = "</table></body></html>"; echo $header.$main.$footer;
转载请注明:小码农 » 简单的PHP excel导出功能