Home >Backend Development >PHP Problem >How to implement page jump in php
How to implement page jump in php: You can use the header() function to achieve it. The specific usage is as follows: [header("Location:https://www.xxx.com");]. It should be noted that there cannot be any output before using the header.
#It is a very simple method to implement page jump through the header() function.
(Recommended tutorial: php graphic tutorial)
The main function of the header() function is to output the HTTP protocol header (header) to the browser.
The function syntax is as follows:
void header (string string [,bool replace [,int http_response_code]])
Parameter description:
The optional parameter replace indicates whether to replace the previous similar header or add a header of the same type. The default is replace .
The optional parameter http_response_code forces the HTTP corresponding code to the specified value.
The Location type header in the header function is a special header call, often used to implement page jumps.
(Recommended video tutorial: php video tutorial)
Note:
1. There cannot be a space between location and ":" , otherwise it will not jump.
2. There cannot be any output before using the header.
3. The PHP code after the header will also be executed.
Code implementation:
< ?php //重定向浏览器 header("Location: //m.sbmmt.com/"); //确保重定向后,后续代码不会被执行 ...... ?>
The above is the detailed content of How to implement page jump in php. For more information, please follow other related articles on the PHP Chinese website!