How to use the header to send header information in PHP
Source: Internet
Author: User
As described in PHPBIBLE by Mr. Peng Wuxing, the header can send the Status header, such? Phpheader ("Status: 404 NotFound ");? In this way, the user's browser can display the 404 error that the file cannot be found, but I tried this. Then I arrived According to Mr. Peng Wuxing's PHP Le, the header can send the Status header, as shown in
Header ('status: 404 Not Found ');
?>
In this way, the user's browser can display the 404 error that the file cannot be found, but I tried this.
Later, I checked the http related materials on w3.org and finally tried to show you how to get the Status code (Status) from the Header.
It should be like this:
Header ('http/1.1 403 Forbidden ');
?>
The first part is the HTTP Version)
The second part is Status code)
Part 3: Reason Phrase (Reason-Phrase)
Use a space in the middle of the three parts, and there is no carriage return in the middle. The first part and the second part are required. The third part is for people to see and can be written or written without writing.
Also, the output of this sentence must be in the first line of the Html file.
Below I will show the meaning of each code (it was found on w3.org and authoritative enough ):
* 1xx: Informational-Request received, continuing process
* 2xx: Success-The action was successfully pinned ed, understood,
And accepted
* 3xx: Redirection-Further action must be taken in order
Complete the request
* 4xx: Client Error-The request contains bad syntax or cannot be
Fulfilled
* 5xx: Server Error-The server failed to fulfill an apparently
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.