Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The specific usage of the page jump function of PHP

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the specific usage of the page jump function of PHP", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn the specific usage of the page jump function of PHP.

PHP itself does not have a full sense of the PHP page jump function, maybe the Header function is one, but it can only be used on the * lines of the page. If you put it in the * position of the PHP page, an error will be reported unless the previous PHP does not output any characters.

Here are three methods of PHP automatic page jump, one is to use Header function, the other is to use HTML inherent tags, 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, use Js code to achieve the purpose of automatic PHP page jump, similarly, this method is also applicable to languages other than PHP It's just the corresponding language code is different.

PHP page jump function 1. Use HTTP header information (Header function)

That is, using the HEADER function of PHP. The function of the HEADER function in PHP is to issue to the browser the control instructions specified by the HTTP protocol that should have passed through the WEB server, such as declaring the type of information returned ("Context-type: xxxx/xxxx"), the properties of the page ("No cache", "Expire"), and so on.

The method to automatically jump PHP to another page with HTTP header information is as follows:

< ?PHP $url = czbin.PHP Header("HTTP/1.1 303 See Other"); Header("Location: $url"); exit; ?>

Notice that "Localtion:" is followed by a space.

PHP page jump function 2. Use HTML tags (REFRESH attribute in META)

Tagging with HTML is marked with META's REFRESH, as an example:

< ?PHP $url = czbin.PHP;?>

< HTML>

< HEAD>

< META HTTP-EQUIV="REFRESH" CONTENT="10; URL=< ? echo $url;?>

>

< /HEAD>

< BODY>

< /BODY>

< /HTML>

Note: the word "CONTENT=" 10 here means to jump after 10 seconds.

The jump function of PHP page is realized by JAVASCRIPT script.

Examples are as follows:

< ?PHP $url=czbin.PHP; echo "< !--< SCRIPT LANGUAGE="JavaScript">

"; echo" location.href='$url' "; echo"

< /SCRIPT>

-- > ";? > at this point, I believe you have a deeper understanding of" the specific usage of the page jump function of PHP ". You might as well do it in practice! here is the website, more related content can enter the relevant channels to query, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report