Let's take a look at an example: header (#39; location: www.phprm.com #39;); the above is a simple jump. what should we do to make a permanent turn. syntax: header (stri... let's take a look at an example: header ('Location: http://www.phprm.com/'); above is a simple jump, we want to do permanent turn how to do it, as follows.
Syntax:Header (string, replace, http_response_code)
Parameter description
String is required, which specifies the header string to be sent.
Optional. indicates whether to replace the previous header or add a second header.
The default value is true (replace) and false (multiple headers of the same type are allowed ).
Http_response_code (optional) sets the http response code to the specified value. php 4 and later are available. In other cases, http_response_code is the 301 code to be written, as shown below:
$ Url = "http://www.phprm.com"; header ("http/1.1 301 moved permanently"); header ("location: $ url"); exit ();
Note:After php 4.4, this function prevents multiple headers from being sent at a time, which is a protection against header injection attacks.
Article link:
Save this article for favorites!