엑셀저장
본문
아래코드 좀 봐주세요
이대로 하면 아래처럼 글이 깨지고 엑셀형태로 출력이 안되요
?깅챸 | ?곕졊 | ?뚯궗紐?/th> | ?깅퀎 | 李멸???/th> | |
1 | 3 | 23 | 8 | 1 | |
10 26 7 1 5 3 70 4 3 1 1 17 1 0 5 1 70 25 4 5 2 30 10 11 32 7 5 51 16 8 14 3 12 6 72 30 ??/td> 12 3 70 14 1 3 0 13 1
|
<?
$sExcelFileName = "bogo" . date("Y") . "-" . date("m") . "-" . date("d") . ".xls";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-type: application/vnd.ms-excel; charset=euc-k");
header( "Content-Disposition: attachment; filename = '$sExcelFileName'" );
header( "Content-Description: PHP4 Generated Data" );
include_once('../../../common.php');
?>
<table border="0">
<tr>
<th>성명</th>
<th>연령</th>
<th>회사명</th>
<th>성별</th>
<th>참관일</th>
</tr>
<? $bo_table = 'bogo';
$write_table = "g5_write_{$bo_table}";
$sql = " select * from $write_table";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{ ?>
<tr>
<td style="mso-number-format:\@"><?=$row['wr_1'];?></td>
<td style="mso-number-format:\@"><?=$row['wr_2'];?></td>
<td style="mso-number-format:\@"><?=$row['wr_3'];?></td>
<td style="mso-number-format:\@"><?=$row['wr_4'];?></td>
<td style="mso-number-format:\@"><?=$row['wr_5'];?></td>
</tr>
</table>
<? }?>
뭐가 문제일까요?고생 엄청하네요
답변 4
<?
$sExcelFileName = "bogo" . date("Y") . "-" . date("m") . "-" . date("d") . ".xls";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-type: application/vnd.ms-excel; charset=euc-kr");
header( "Content-Disposition: attachment; filename = '$sExcelFileName'" );
header( "Content-Description: PHP4 Generated Data" );
include_once('../../../common.php'); ---> 이라인을
?>
<?
include_once('../../../common.php');
$sExcelFileName = "bogo" . date("Y") . "-" . date("m") . "-" . date("d") . ".xls";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-type: application/vnd.ms-excel; charset=euc-kr");
header( "Content-Disposition: attachment; filename = '$sExcelFileName'" );
header( "Content-Description: PHP4 Generated Data" );
?>
이렇게 먼저 해보세요
감사합니다 그런데 안되네요
euc-kr r 빠진부분만 수정해보시고
header 아랫부분에
Print("<Meta Http-Equiv=\"Content-Type\" Content=\"Application/Vnd.Ms-Excel; Charset=Euc-Kr\">");
추가해보시겠어요?