For you to explain the specific meaning of the PHP page jump function. PHP itself does not have a fully functional PHP page jump function. maybe the Header function is regarded as one, but it can only be used for the first line of the page. If it is placed at the end of the PHP page
PHP itself does not have a fully functional PHP page jump function. maybe the Header function is regarded as one, but it can only be used for the first line of the page. If it is placed at the end of the PHP page, an error will be reported unless the preceding PHP does not output any characters.
The following three PHP automatic page jump methods are provided: one is to use the Header function, and the other is to use the inherent HTML mark. of course, this method can be applied not only to PHP, but also to ASP ,. net, and Jsp, the third method is to output Javascript, using Js code to achieve PHP page automatic jump purpose, the same, this method is also applicable to other languages than PHP, the corresponding language code is different.
PHP page jump function 1. use HTTP Header information (Header function)
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: xxxx/xxxx "), page attributes (" No cache "," Expire "), and so on.
You can use the HTTP header to automatically redirect PHP to another page as follows:
- < ?PHP
- $url = czbin.PHP
- Header("HTTP/1.1 303 See Other");
- Header("Location: $url");
- exit;
- ?>
Note that "Localtion:" is followed by a space.
PHP page jump function 2. use HTML tags (REFRESH attribute in META)
The HTML tag is the REFRESH tag of META, for example:
- < ?PHP $url = czbin.PHP;?>
- < HTML>
- < HEAD>
- < META HTTP-EQUIV="REFRESH"
CONTENT="10; URL=< ? echo $url;?>>
- < /HEAD>
- < BODY>
- < /BODY>
- < /HTML>
Note: CONTENT = "10 indicates that the jump will take 10 seconds.
PHP page jump function 3. implemented using JAVASCRIPT scripts
Example:
- < ?PHP
- $url=czbin.PHP;
- echo "< !--< SCRIPT LANGUAGE="JavaScript">";
- echo "location.href='$url'";
- echo "< /SCRIPT>-->";
- ?>
PHP does not have a fully functional PHP page jump function. maybe the Header function is regarded as one, but it can only be used for the first line of the page. If it is placed at the end of the PHP page ,...