In PHP to implement the jump there are many ways, the most common way to jump is to use the header function to operate, of course, you can also enter the JS jump in php form, let me give you a brief introduction.
PHP Jump
The code is as follows |
Copy Code |
Header ("location:http://www.bkjia.c0m"); ?> |
The header function uses
PHP page Jump One, header () function
The header () function is a very simple way to jump a page in PHP. The main function of the header () function is to output the HTTP protocol header (header) to the browser.
The header () function is defined as follows:
void header (String string [, bool replace [, int http_response_code]]) Optional parameter replace indicates whether to replace the previous similar header or to add a header of the same type, which is replaced by default.
The Second optional parameter, Http_response_code, forces the HTTP corresponding code to be set to the specified value. The header of the location type in the header function is a special header call that is commonly used to implement page jumps. Note: There can be no spaces between 1.location and ":", otherwise it will not jump.
2. There can be no output before using the header.
PHP code after 3.header will also be executed. For example, redirect your browser to the Crown Gateway Blog
The code is as follows |
Copy Code |
< PHP redirect Browser Header ("location:http://www.bkjia.c0m"); Ensure that subsequent code is not executed after redirection Exit ?> |
PHP page jump two, meta tags
The META tag is the tag in HTML that is responsible for providing the meta-information of the document, which can be used in a PHP program or a page jump. If you define HTTP-EQUIV as refresh, the page will be opened to the appropriate page for a certain amount of time based on the values specified in the content.
If you set content= "seconds; url= url", you define how long it takes for the page to jump to the specified URL. For example, using meta tags to implement the vaccine after the page automatically jumps to the Crown Wei blog.
The code is as follows |
Copy Code |
< meta http-equiv= "refresh" content= "1;url=http://www.bkjia.c0m" > |
For example, the following program meta.php the page to automatically jump to www.bKjia.c0m after a second stay in the page.
The code is as follows |
Copy Code |
$url = "http://www.bKjia.c0m";?> < html> < head> < meta http-equiv= "Refresh" content= "1; url=<? php echo $url;?> "> < body> The page only stays for one second ... </body>
|
PHP page Jump Three, JavaScript (common, recommended)
For example, this code can be placed in any legitimate location in the program.
The code is as follows |
Copy Code |
$url = "http://www.bKjia.c0m"; echo ""; ?> |
Attach some JS jump method
JavaScript Jump
Method One:
The code is as follows |
Copy Code |
|
Method Two:
The code is as follows |
Copy Code |
|
ASP Jump
The code is as follows |
Copy Code |
<% Response.Redirect "http://www.bKjia.c0m" %> |
http://www.bkjia.com/PHPjc/632788.html www.bkjia.com true http://www.bkjia.com/PHPjc/632788.html techarticle in PHP to implement the jump there are many ways, the most common way to jump is to use the header function to operate, of course, you can also enter the JS jump in php form, let me introduce you ...