HEADER functions

xiaoxiao2021-03-06  66

HEADER functions

Author: Unknown Joined: 2004-03-11 Views: 129 header (header) is an HTTP server to pass collusion HTML data before sending to the browser string, still need between the header and the HTML file Empty and one line. For detailed description of HTTP, you can refer to RFC 2068 official document (http://www.w3.org/protocols/rfc2068/rfc2068). Before sending the HTML data in PHP, you need to pass all the headers first. Note: The traditional header must contain one of the three headers below and can only appear once. Content-Type: XXXX / YYYYLOCATION: XXXX: YYYY / ZZZZSTATUS: NNN XXXXXX can appear twice more in the new multi-headed MIME. Example example 1: This example resets the browser to the official website of PHP. Header ("Location: http://www.php.net;>? Example 2: To get the latest information each time, instead of proxy or cache, you can use the following Header ("Expires: MON, 26 JUL 1997 05:00:00 GMT"); Header ("Last-Modified:". Gmdate ("D, D MYH: I: S"). "GMT"); Header "Cache-Control: no-cache, munt-revALIDATE"); Header ("Pragma: no-cache");>? Example 3: Let the user's browser can't find information about the file. Header ("Status: 404 Not Found");>? Example 4: Let the user download the file. Header ("Content-Type: Application / X-Gzip"); Header ("Content-Disposition: attachment; filename = file name"); Header ("Content-Description: PHP3 Generated Data);?>

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

New Post(0)