Home >Backend Development >PHP Tutorial >Excel 2007 official download free full version PHP settings HTTP header information export Excel report
There is no need to use the fputcsv function to generate reports. Just set the corresponding format and HTTPheader information to generate the report. Attached code:
<?php header("Content-type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=excel.xls"); $data = "分类销售统计\t\n"; $data .= "排名\t产品大类\t销售额(万)\t销售占比\t单品数量\n"; if (EC_CHARSET == 'utf-8') { echo ecs_iconv(EC_CHARSET, 'GB2312', $data); } else { echo $data; } ?>
Note: The character conversion step can be omitted according to actual needs.
Original link: http://woqilin.blogspot.com/2016/06/php-http-excel.html
The above introduces the Excel 2007 official download free full version PHP setting HTTP header information to export Excel reports, including the excel 2007 official download free full version content, I hope it will be helpful to friends who are interested in PHP tutorials.