Home  >  Article  >  Backend Development  >  How to set header in php

How to set header in php

WJ
WJOriginal
2020-06-01 09:51:324877browse

How to set header in php

How to set header in php:

First create a new php file, and then add the function "header" to the head of the file

//ok
header(‘HTTP/1.1 200 OK');
//设置一个404头:
header(‘HTTP/1.1 404 Not Found');
//设置地址被永久的重定向
header(‘HTTP/1.1 301 Moved Permanently');
//转到一个新地址
header(‘Location: http://www.example.org/‘);
//文件延迟转向:
header(‘Refresh: 10; url=http://www.example.org/‘);

Finally, run the file in the server environment

Related references:php中文网

The above is the detailed content of How to set header in php. For more information, please follow other related articles on the PHP Chinese website!

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