Several methods for redirecting from the PHP page to another page to share. In PHP, how does one redirect a page to another? Today, Qingyuan offers three methods for your reference. I. how to use HTTP header information, that is, how to use PHP
PHPTo another page? Today
QingyuanThree methods are provided for your reference.
1. use HTTP header information
That is, use the php header function. The HEADER function in PHP is used to send control commands that should have been specified by the HTTP protocol to the browser through the WEB server, such as declaring the type of returned information ("Context-type: xxx/xxx "), page attributes (" No cache "," Expire "), and so on. (PS: php q buckle token: 304224365, verification: csl)
To redirect an HTTP header to another page, follow these steps:
The code is as follows:
Note that "Localtion:" is followed by a space.
II. mark with HTML
The HTML tag is the REFRESH tag of META, for example:
The code is as follows:
"; Echo" location. href = '$ url' "; echo"--> ";?>
Below is a supplement
Fourth:
Echo "<meta http-equiv = \" Refresh \ "content = \" seconds; url = redirected file or address \ "> ";
Where: XX indicates the number of seconds, and 0 indicates the jump immediately. refresh indicates the refresh. Url indicates the page to jump.
Fifth: Using script
《script》url="submit.php";window.location.href=url;《script》
Method 6: execute scripts. The difference is that open statements can be used, and the original window, parent window, child window, or new window can be restricted.
《script》url="submit.php";window.open(\'url,\'\',\'_self\');《script》
Change \ '_ self \' to limit whether the original window is a parent window, a subwindow, or a new window. 7. use the php built-in function to send the header information.
header("Location: Url");
Fast and powerful... but there is a problem that must be pointed out: if there is html output before using this function, even if it is a space. the error message is displayed at the top of the page ..
What about redirecting from one page to another in PHP? Today, Qingyuan offers three methods for your reference. 1. use HTTP header information, that is, use PHP...