PHP | CSV 파일 생성시 깨지지 않게 하는 방법

|
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>

참조

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

클릭하여 복사