Home > Backend Development > PHP Tutorial > Detailed usage introduction of PHP header function_PHP tutorial

Detailed usage introduction of PHP header function_PHP tutorial

WBOY
Release: 2016-07-15 13:32:07
Original
1012 people have browsed it

What we are going to introduce to you today is about

// PHP header function sends 404 status code to the browser
header(“HTTP/1.1 404 Not Found”);
or
header(“HTTP/1.1 404″);

// PHP header function permanently redirects
header(“Location: http ://weizhifeng.net/”);//The default is 301 jump
// Temporary redirection
header(“HTTP/1.1 302 Found”);
header(“Location: http:/ /weizhifeng.net/”);


// PHP header function download file
header(“Content-type: text/plain'); // Can be replaced with the MIME type you need
header('Content-Disposition: attachment; filename="weizhifeng.txt"');
readfile('weizhifeng.txt');


For other header information, please refer to HTTP /1.1 specification
If there is already output before the PHP header function, please use the ob_start() function


.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446156.htmlTechArticleWhat we are going to introduce to you today is the // PHP header function sends 404 status code header (HTTP /1.1 404 Not Found); or header(HTTP/1.1 404); // PHP header function permanently resets...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template