Home  >  Article  >  Backend Development  >  PHP function header releases HTTP header information_PHP tutorial

PHP function header releases HTTP header information_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:34:241406browse

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

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

// 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 the HTTP/1.1 specification
If there is output before the header, please use the ob_start() function.


http://www.bkjia.com/PHPjc/445995.html

truehttp: //www.bkjia.com/PHPjc/445995.htmlTechArticle// Send 404 status code header(HTTP/1.1 404 Not Found); or header(HTTP/ 1.1 404); //Permanent redirect header(Location: http://weizhifeng.net/);//The default is 301 jump//...
Statement:
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