There is only one way to implement page jump in php, which is to use header(location:$go_url); to achieve page jump, let me introduce it to you in detail below.
php header() page jump
I moved my blog from http://www.yourdomain/blog to http://www.bKjia.c0m. When users visit the previous blog address, they will automatically jump to the corresponding article of the current blog
The code is as follows | Copy code | ||||
$go_url=str_replace('http://www.yourdomain name/blog','http://www.bKjia.c0m',$url_this); |
The header() function is defined as follows:
The optional parameter replace specifies whether to replace the previous similar header or add a header of the same type. The default is replace.
The second optional parameter http_response_code forces the HTTP response code to the specified value. The Location type header in the header function is a special header call, often used to implement page jumps.
Note:
2. There cannot be any output before using the header. 3. The PHP code after the header will also be executed.
There is also a js+php page jump method
JavaScript (commonly used, recommended)
代码如下 | 复制代码 |
< ?php |
For example, this code can be placed anywhere in the program that is legal.
echo ""; 1. Page jump code in HTML code HTML meta refresh refresh and jump (redirect) page
* refresh appears in the http-equiv attribute, and uses the content attribute to indicate the start time of refresh or jump and the URL of the jump Click submit and then jump Click the button Use POST method
The code is as follows
Copy code
< ?php
$url = "http://www.bKjia.c0m";
?>
* refresh is used to refresh and jump (redirect) pages
代码如下
复制代码
meta refresh example
Refresh this page after 5 seconds:
代码如下
复制代码
Go to the Dream City homepage in 5 seconds:
The code is as follows
Copy code
The code is as follows
Copy code
The X.php page only performs judgment logic after processing
The code is as follows
|
Copy code
|
||||
//isset function |
http: //www.bkjia.com/PHPjc/631533.html