<?
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=test.xls" ); //test.xls 엑셀 파일이름
header( "Content-Description: PHP4 Generated Data" );
// 엑셀로 출력할 데이터 위에 헤더를 꼭 추가하자!
$a = array("1","2","3");
$b = array("2","4","5");
$sum = array("3","6","8");
echo "
<table>
<tr>
<td>a</td>
<td>b</td>
<td>sum</td>
</tr>
";
for($i=0; $i<3; $i++) {
echo "<tr><td>$a[$i]</td><td>$b[$i]</td><td>$sum[$i]</td></tr>";
}
echo "
</table>
";
?>
이거는 제일 간단한 엑셀 파일 저장 방법이고 조금더 디테일 하게는 php class 를 이용하는 방법도
있다 class 이용 방법은 아래 링크에서 잘 설명 되있으니 참고 하시길~
http://www.moonseller.net/150
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=test.xls" ); //test.xls 엑셀 파일이름
header( "Content-Description: PHP4 Generated Data" );
// 엑셀로 출력할 데이터 위에 헤더를 꼭 추가하자!
$a = array("1","2","3");
$b = array("2","4","5");
$sum = array("3","6","8");
echo "
<table>
<tr>
<td>a</td>
<td>b</td>
<td>sum</td>
</tr>
";
for($i=0; $i<3; $i++) {
echo "<tr><td>$a[$i]</td><td>$b[$i]</td><td>$sum[$i]</td></tr>";
}
echo "
</table>
";
?>
이거는 제일 간단한 엑셀 파일 저장 방법이고 조금더 디테일 하게는 php class 를 이용하는 방법도
있다 class 이용 방법은 아래 링크에서 잘 설명 되있으니 참고 하시길~
http://www.moonseller.net/150
'JSP' 카테고리의 다른 글
이클립스 단축키 (0) | 2012.04.27 |
---|---|
리눅스 기초 명령어 모음 (0) | 2011.08.02 |