Commonly used header definitions in PHP
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 08:42:57
Original
777 people have browsed it
- header('HTTP/1.1 200 OK'); // ok normal access
- header('HTTP/1.1 404 Not Found'); //Notify the browser that the page does not exist
- header(' HTTP/1.1 301 Moved Permanently'); //Set the address to be permanently redirected 301
- header('Location: http://www.ithhc.cn/'); //Jump to a new address
- header( 'Refresh: 10; url=http://www.ithhc.cn/'); //Delayed redirection means jumping every few seconds
- header('X-Powered-By: PHP/6.0.0'); / /Modify X-Powered-By information
- header('Content-language: en'); //Document language
- header('Content-Length: 1234'); //Set content length
- header('Last-Modified: ' .gmdate('D, d M Y H:i:s', $time).' GMT'); //Tell the browser the last modification time
- header('HTTP/1.1 304 Not Modified'); //Tell the browser The document content has not changed
- ###Content type###
- header('Content-Type: text/html; charset=utf-8'); //Web page encoding
- header('Content-Type: text/plain '); //Plain text format
- header('Content-Type: image/jpeg'); //JPG, JPEG
- header('Content-Type: application/zip'); // ZIP file
- header('Content -Type: application/pdf'); // PDF file
- header('Content-Type: audio/mpeg'); // Audio file
- header('Content-type: text/css'); //css file
- header('Content-type: text/javascript'); //js file
- 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 animation
- ##### #
- ###Declare a downloaded file###
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="ITblog.zip"');
- header('Content-Transfer-Encoding: binary');
- readfile('test.zip');
- ######
- ###Disable caching for the current document###
- header('Cache- Control: no-cache, no-store, max-age=0, must-revalidate');
- header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
- ######
-
- ###Display a login dialog box that requires authentication###
- header('HTTP/1.1 401 Unauthorized');
- header('WWW-Authenticate: Basic realm="Top Secret"');
- #### ##
- ###Declare an xls file that needs to be downloaded###
- 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');
- ######
- ?>
Copy code
|
PHP, header
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31