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!