Home >Backend Development >PHP Tutorial >How to implement timed jump in PHP page, PHP page jump_PHP tutorial

How to implement timed jump in PHP page, PHP page jump_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:15:34873browse

How to implement timed jump in PHP page, PHP page jump

The example in this article describes how to implement scheduled jumps on PHP pages, and is shared with everyone for your reference. The specific implementation method is as follows:

PHP scheduled jump We need to use the header function to enter html or js code to achieve scheduled jump. Let me introduce a simple example below

The php code is as follows:

Copy code The code is as follows:
header("refresh:3;url=http://www.bkjia.com");
print('Loading, please wait...
It will automatically jump to Bangke Home in three seconds~~~');

The output html code is
Copy code The code is as follows:
The same effect.
In this way, it will automatically jump to http://www.bkjia.com after 3 seconds.

What needs to be noted here is: if your file is uft-8 encoded, we must be careful not to have output or BOM characters before the header, which may cause the jump to fail.

I hope this article will be helpful to everyone’s PHP programming design.

How to realize automatic jump of php page after 15 seconds

Php itself does not have a complete page jump function. Maybe the Header function is one, but it can only be used for the first line of the page. If placed at the end of the Php page, unless the previous Php does not output any characters, an error will be reported. The following are three methods for automatic page jump in Php:
1: Use the Header function.
Two: Use HTML inherent tags. (Not only applicable to Php, but also applicable to ASP, .Net, and Jsp).
Three: Output javascript and use Js code to achieve the purpose of automatic jump to the Php page. (It also applies to languages ​​other than Php, but the corresponding language codes are different). 1. Use HTTP header information (Header function)
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: xxxx/xxxx"), the attributes of the page ("No cache", "Expire"), etc.
The method to use HTTP header information to make Php automatically jump to another page is as follows:
$url = index.php
Header("HTTP/1.1 303 See Other") ;
Header("Location: $url");
exit;
?>
Note that there is a space after "Localtion:". 2. Use HTML tags (REFRESH attribute in META)
Use HTML tags, that is, use META’s REFRESH tag. For example:

< ;HTML>

as follows:
$url=index.php;
echo "";
?>
-------- -------------------------------------------------- -------------------------------------------------- ---
//PHP comes with function
Header("Location: www.php.com ");
?>
/ /Use meta
echo "In addition, writing methods such as header('Location: test/test113.php'); are also possible.

Maybe you made a mistake. When writing a relative path in the header, it is relative to the executed script. For example, I write

in test.php in the
include folder and then include it with test2.php in another folder. It

When you access test2.php at this time, you go to index.php
under another to access test. When using php, it goes to index.php under include

——————————————Separating line———————————— ——————
Please accept it if you are satisfied (⊙o⊙). The above is the answer brought to you by the R&H Qianshi team.
If you don’t understand anything, you can ask. If you have any questions in the future, you can ask me or my team. (*^__^*) Hee hee...

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/904016.htmlTechArticleHow to implement timed jumps on PHP pages, PHP page jumps This article describes how to implement timed jumps on PHP pages The method is shared with everyone for your reference. The specific implementation method is as follows: php determines...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn