Home > Backend Development > PHP Problem > How to set header in php

How to set header in php

WJ
Release: 2023-03-01 09:42:02
Original
4885 people have browsed it

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/‘);
Copy after login

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!

Related labels:
php
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