How to use header in PHP
How to use header in PHP? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Jump page
There is no space between header ('Location:'.$url); / / Location and':'.
Declare content-type
Header ('content-type:text/html;charset=utf-8')
Returns the response status code
Header ('HTTP/1.1 404 Not Found')
Perform a jump after a certain period of time
Jump after header ('Refresh: 10; url= http://www.baidu.com/'); / / 10s).
Control browser caching
Header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT")
Header ("Last-Modified:" Gmdate ("D, d M Y H:i:s") "GMT")
Header ("Cache-Control: no-cache, must-revalidate")
Header ("Pragma: no-cache")
Perform http verification
Header ('HTTP/1.1 401 Unauthorized')
Header ('WWW-Authenticate: Basic realm= "Top Secret"')
Perform download operation
Header ('Content-Type: application/octet-stream'); / / sets the content type
Header ('Content-Disposition: attachment; filename= "example.zip"); / / set MIME users as attachments
Header ('Content-Transfer-Encoding: binary'); / / sets the transmission method
Header ('Content-Length:' .filesize ('example.zip')); / / set the content length
This is the answer to the question about how to use header in PHP. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.