상세 컨텐츠

본문 제목

php 엑셀파일 저장

인터넷/프로그래밍/홈페이지

by 길상여의 2008. 10. 29. 09:38

본문

php에서 각종 데이터를 엑셀파일로 저장하기 위한 소스입니다.

<?
$fname = "신청자명단_".date("Ymd_His");

header( "Content-type: application/vnd.ms-excel;charset=euc_kr" );
header( "Content-Disposition: attachment; filename=$fname.xls" );
header("Pragma: no-cache");
header("Expires: 0");
?>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td>신윤복</td>
<td>2008-10-12</td>
</tr>
<tr>
<td>베토벤</td>
<td>2008-10-11</td>
</tr>
</table>

위 소스와 같이 하는 경우도 있고, 아님 ..저장되는 php소스 아래에다가
엑셀로 만든 파일을 html로 변환하여 사용하는 경우도 있습니다.

사실 엑셀 html로 사용하는 경우가 더 깔끔한거 같습니다.




관련글 더보기