How to send head information in PHP

zhaozj2021-02-16  58

How to send head information in PHP

Header can send a Status header in the "php bible" of Mr. Peng Wuxing.

Header ("Status: 404 Not Found");> You can let the user browser appear 404 errors that can be found, but I tried it. Later I went to W3.org to check the relevant information about HTTP, I finally tried out how the Header's state code (STATUS) is shared with you. It should actually be like this: Header ("http / 1.1 403 forbidden");?> The first part is the second part of the HTTP protocol (http-version) Part III for the Status Code (Reason-Phrase) The three parts are separated by a space, and the middle cannot have a carriage return, the first part and the second part are required, and the third part is to people, it can be written without writing. Also, the output of this sentence must be in the first line of the HTML file.

Below I gave the meaning represented by each code (is from W3.org, enough authority): * 1xx: INFORMATIONAL - Request Received, Continuing Process * 2xx: Success - The Action Was SuccessFully Received, Understood, And accepted * 3xx: Redirection - Further action must be taken in order to complete the request * 4xx: Client Error - The request contains bad syntax or can not be fulfilled * 5xx: Server Error - The server failed to fulfill an apparently valid request | "100 "; Continue |" 101 "; Switch Protocols |" 200 "; OK |" 201 "; create |" 202 "; accepted |" 203 "; non-authoritative information |" 204 "; no content |" 205 "; reset Content | "206"; Partial Content | "300"; MULTIPLE Choices | "301"; Moved Permanently | "302"; Moved Temporarily | "303"; See Other | "304"; NOT MODIFIED | "305"; Use Proxy "400"; Bad Request | "401"; Unauthorized | "402"; payment request | "403" Forbidden | "404"; NOT FOUND | "405"; Method Not Allowed | "406"; NOT ACCEPTABLE | "407"; Proxy Authentication Required | "408"; Request Time-Out | "409"; Conflict | 410 ";" 412 "; precondition failed |" 413 "; Request Entity TOO LARGE |" 414 "; Request-Uri Too Large |" 415 "; unsupported Media Type |" 500 "; Internal Server Error | "501";

转载请注明原文地址:https://www.9cbs.com/read-19113.html

New Post(0)