Common methods of PHP header() function_PHP tutorial
Release: 2016-07-13 10:32:54
Original
687 people have browsed it
//Define encoding
//Atom
//CSS
//Javascript
//JPEG Image
//JSON
//PDF
//RSS
//Text (Plain)
//XML
// ok
//Set a 404 header:
//Set the address to be permanently redirected
//Go to a new address
//File delayed redirection:
print 'You will be redirected in 10 seconds';
//Of course, you can also use html syntax to achieve it
// header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile ('example.zip');
//Disable caching for the current document
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');
//Set content type:
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); //Plain text format
header('Content-Type: image/jpeg'); //JPG***
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio file
header('Content-Type: application/x-shockw**e-flash'); //Flash animation
//Show login dialog box
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';
http://www.bkjia.com/PHPjc/753935.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/753935.htmlTechArticle//Define encoding//Atom //CSS //Javascript //JPEG Image //JSON //PDF / /RSS //Text (Plain) //XML // ok //Set a 404 header: //Set the address to be permanently redirected //Go to a new address...
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