echo "\xEF\xBB\xBF"; // 얠 넣어줘야 안깨짐...
<?php
//header ("Expires: Mon, 28 Oct 2008 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/vnd.ms-excel");
header( "Content-type: application/vnd.ms-excel; charset=utf-8");
header ("Content-Disposition: attachment; filename=\"".$filename.".xls" );
header ("Content-Description: Generated Report" );
echo "\xEF\xBB\xBF"; // 2020.08.12 추가, 엑셀에서 파일열었을때 한글 깨짐 수정
?>
<style>
table { border:2px #000 solid; }
th { border-right:1px #999 solid; border-bottom:1px #000 solid; }
td { border-right:1px #999 solid; border-bottom:1px #999 solid; }
</style>
참조