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 [, intht
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
View plaincopy to clipboardprint?
<? Php
// Redirect the browser
Header ("Location: http://blog.csdn.net/abandonship ");
// Ensure that subsequent code will not be executed after redirection
Exit;
?>
<? Php
// Redirect the browser
Header ("Location: http://blog.csdn.net/abandonship ");
// Ensure that subsequent code will not be executed after redirection
Exit;
?>
PHP page jump 2. Meta tag
Meta tag is the tag that provides document Meta information in HTML. you can use this tag in a PHP program to redirect pages. If http-equiv is defined as refresh, the page will be redirected to the corresponding page within a certain period of time based on the value specified by content. If you set content = "seconds; url = url", it defines how long the page will jump to the specified url.
<Meta http-equiv = "refresh" content = "1; url = http://blog.csdn.net/abandonship">
For example, the following meta. php program automatically redirects to the page one second later.
View plaincopy to clipboardprint?
$ Url = "http://blog.csdn.net/abandonship ";
?>
Its transit station.
$ Url = "http://blog.csdn.net/abandonship ";
?>
Its transit station.
PHP page jump 3. JavaScript
View plaincopy to clipboardprint?
$ Url = "http://blog.csdn.net/abandonship ";
Echo"