헤더의 몇 가지 사용법
header('Location:'.$url); //Location ":" 。
2. 콘텐츠-type 선언
header('Content-Type: text/html; charset=utf-8'); //
header('Content-Type: text/plain'); //
header('Content-Type: image/jpeg'); //JPG、JPEG
header('Content-Type: application/zip'); // ZIP
header('Content-Type: application/pdf'); // PDF
header('Content-Type: audio/mpeg'); //
header('Content-type: text/css'); //css
header('Content-type: text/javascript'); //js
header('Content-type: application/json'); //json
header('Content-type: application/pdf'); //pdf
header('Content-type: text/xml'); //xml
header('Content-Type: application/x-shockw**e-flash'); //Flash
3. response 상태 코드를 되돌려줍니다
header('HTTP/1.1 200 OK'); // ok
header('HTTP/1.1 404 Not Found'); //
header('HTTP/1.1 301 Moved Permanently'); // 301
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); //
header('HTTP/1.1 304 Not Modified'); //
4. 일정 시간 후 점프 수행
header('Refresh: 10; url=http://www.baidu.com/'); //
5. 브라우저 캐시 제어
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
6. http 검증 실행
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
7. 다운로드 작업 수행
header('Content-Type: application/octet-stream'); //
header('Content-Disposition: attachment; filename="example.zip"'); // MIME
header('Content-Transfer-Encoding: binary'); //
header('Content-Length: '.filesize('example.zip')); //
// xls
header('Content-Disposition: attachment; filename=ithhc.xlsx');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Length: '.filesize('./test.xls'));
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate');
header('Pragma: public');
readfile('./test.xls');
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.