용도별 PHP Header
PHP Header 부분 설정을 항상 복붙해서 쓰기때문에
저장용으로 써놓습니다.
Ajax Request 용
header('P3P: CP="CAO PSA CONi OTR OUR DEM ONL"'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Pragma: no-cache"); header("Cache-Control: no-store,no-cache,must-revalidate"); header('Cache-Control: post-check=0, pre-check=0', FALSE);
JSON
header("Content-Type: application/json;charset=utf-8");
Excel 다운로드용
header( "Content-type: application/vnd.ms-excel" ); header( "Content-type: application/vnd.ms-excel; charset=utf-8"); header( "Content-Disposition: attachment; filename = invoice.xls" ); header( "Content-Description: PHP4 Generated Data" );
XML 파일용
header('content-type: text/xml'); header('cache-control: no-cache, must-revalidate'); header('pragma: no-cache');
일반적인 파일다운로드용
header("content-type: file/unknown"); header("content-length: ".filesize($filepath)); header("content-disposition: attachment; filename={$filename}"); header("content-description: php generated data");