Server

php) 엑셀로 저장하기

by 디케 posted May 24, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

php) 엑셀로 저장하기

 

 

좌측으로 셀이동 =  \t

아래로 이동 =  \r

 

간단하죠잉?~

샘플코드


<?

$output_file_name = "다운로드.xls";

        header( "Content-type: application/vnd.ms-excel" );

header( "Content-Disposition: attachment; filename={$output_file_name}.xls" );

header( "Content-Description: PHP4 Generated Data");

?>

 

 

 

 또는

header("Content-type: application/vnd.ms-excel"); 
header("Content-Disposition: attachment; filename=파일명.xls");
header("Content-Description: 파일설명"); 
header("Content-charset=언어셋");

주의할점 : header() 함수를 쓰기전에 어떠한 출력도 있어선 안된다. 출력이 있을경우 Cannot modify~~라는 오류 구문에러가 날것임