Sometimes users will jump to pages when writing PHP. Here we have collected several good jump methods that can be used.
Using HTTP header information
That is, use PHP’s HEADER function. The function of the HEADER function in PHP is to issue control instructions to the browser that should be passed through the WEB server specified by the HTTP protocol, such as declaring the type of return information ("Context-type: xxx/xxx"), the attributes of the page ("No cache", "Expire"), etc.
The method to redirect to another page using HTTP header information is as follows:
The code is as follows:
Marked with HTML
Use HTML tag, that is, use REFRESH tag of META, for example:
The code is as follows:
Use script to implement
The code is as follows:
Use html features
The code is as follows:
Where: XX is the number of seconds, 0 means jump immediately. refresh means refresh. Url is the page to jump to.
Use script to implement
The code is as follows:
Another implementation using script
Use script to implement, the difference is the use of the open statement. And you can limit the original window to the parent window, child window or new window.
The code is as follows:
Change '_self' to limit the jump to the original window, parent window, child window or new window. The seventh method: use PHP's own function to send header information
The code is as follows:
The fastest and most powerful... But there is a problem that must be pointed out: if there is already html output before using this function, even if it is a space, then an error message will be displayed at the top of the page..