Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- date포맷
- strpos
- strtotime
- 시간계산
- indexOf
- 이전주소
- JQuery
- Selector
- HTML
- Javascript
- mysql
- element추가
- mb_strimwidth
- disabled
- parent of iframe
- Meta Tag
- 세션
- php
- File
- 문자열포함여부
- date
- SubString
- attr
- 세션사용법
- accept
- 웹프로그래밍
- CSS
- 쿠키
- input
- ucfirst
Archives
- Today
- Total
Heojju
[PHP] 데이터 엑셀로 저장기능 본문
<?
header( "Content-type: application/vnd.ms-excel; charset=utf-8" );
header( "Cache-Control: must-revalidate, post-check=0,pre-check=0" );
header( "Content-Disposition: attachment; filename=test.xls" );
header( "Pragma: public" );
$array1 = array("1","2","3");
$array2 = array("11","22","33");
$thead = "
<tr>
<td>값1</td>
<td>값2</td>
<td>합계</td>
</tr>
";
for($i=0; $i<sizeof($array1); $i++){
$content = "
<tr>
<td>$array1[$i]</td>
<td>$array2[$i]</td>
<td>".( $array1[$i] + $array2[$i] )."</td>
</tr>
";
}
echo "<table>".$thead.$content."</table>";
?>
filename 은 변경 가능합니다.
'웹개발 > PHP' 카테고리의 다른 글
[PHP] strpos() 문자열 포함 여부 확인 (0) | 2016.12.19 |
---|---|
[PHP] str_word_count() - 문자열 카운트 (0) | 2016.12.14 |
[PHP] strtotime 함수 (0) | 2016.12.06 |
[PHP] strip_tags 를 이용한 태그 삭제 (0) | 2016.11.30 |
[PHP] Date 포맷 (0) | 2016.11.30 |