PHP page Jump 1. the header () function is a very simple method for page Jump in PHP. The main function of the header () function is to output the HTTP header to the browser. The header () function is defined as follows: voidheader (stringstring [, boolreplace [, inthttp_response_code]) can
PHP page Jump 1. the header () function is a very simple method for page Jump in PHP. The main function of the header () function is to output the HTTP header to the browser. The header () function is defined as follows: void header (string [, bool replace [, int http_response_code]) can
PHP page Jump 1. header () function
The header () function is a very simple method for page Jump in PHP. The main function of the header () function is to output the HTTP header to the browser.
The header () function is defined as follows:
Void header (string [, bool replace [, int http_response_code])
The optional parameter replace indicates whether to replace the previous header or add a header of the same type. The default parameter is replace.
The second optional parameter http_response_code sets the HTTP code as the specified value. The Location header in the header function is a special header call, which is often used to redirect pages. Note: 1. There cannot be spaces between location and:. Otherwise, no jump will be made.
2. There cannot be any output before using the header.
3. the PHP code after the header will also be executed. For example, redirect a browser to a guanwei blog
<? Php
// Redirect the browser
Header ("Location: http://www.guanwei.org ");
// Ensure that subsequent code will not be executed after redirection
Exit;
?>
<Meta http-equiv = "refresh" content = "1; url = http://www.guanwei.org">
For example, the following meta. php program will automatically jump to www.guanwei.org after one second in the page.
<? Php
$ Url = "http://www.guanwei.org";?>
<Html>
<Head>
<Meta http-equiv = "refresh" content = "1; url = <? Php echo $ url;?> ">
</Head>
<Body>
The page stays for only one second ......
</Body>
</Html>
PHP page Jump 3. JavaScript (common and recommended)
For example, this code can be placed in any legal position in the program.
<? Php
$ Url = "http://www.guanwei.org ";
Echo"