PHP page to implement timed jump method, PHP page Jump _php Tutorial

Source: Internet
Author: User

PHP page to implement a timed jump method, PHP page jump


The example of this article describes the PHP page to implement timed jump method, share for everyone to reference. The implementation method is as follows:

PHP timed jump We need to use the header function to input HTML or JS code to achieve timed jumps, let me introduce a simple example

The PHP code is as follows:

Copy the Code code as follows: Header ("refresh:3;url=http://www.bkjia.com");
Print (' Loading, please wait ...
Three seconds after the automatic jump to help guests home ~ ~ ~ ');
The HTML code for the output is
Copy the Code code as follows: the same effect.
This enables the automatic jump to http://www.bkjia.com after 3 seconds.

It is important to note that if your file is uft-8 encoded, we should be careful not to have output or BOM characters in front of the header, which can lead to the inability to jump.

I hope this article is helpful to everyone's PHP programming.


How to implement PHP page 15 seconds after automatic jump

PHP itself does not have a full page jump function, perhaps the header function is one, but it can only be used for the first line of the page. If placed in the last position of the PHP page, unless the previous PHP does not output any characters, the error will be. Here are three ways to jump from a PHP automatic page:
One: Use the header function.
Two: Use HTML intrinsic markup. (not only for PHP, but also for Asp,.net, as well as for JSPs).
Three: Output JavaScript, the use of JS code, to achieve the purpose of automatic PHP page jump. (It also applies to languages other than PHP, but the corresponding language code is different). First, with the HTTP header information (header function)
That is, using the header function of PHP. The function of the header function in PHP is to send the browser a control instruction that is supposed to pass through the Web server, such as declaring the type of return information ("Context-type:xxxx/xxxx"), the properties of the page ("No cache", " Expire ") and so on.
The method of using HTTP header information to automatically jump to another page is as follows:
$url = index.php
Header ("http/1.1 303 See other");
Header ("Location: $url");
Exit
?>
Notice that "localtion:" has a space behind it. Second, the use of HTML tags (the refresh attribute in meta)
Use HTML markup, which is the refresh tag of meta, for example:




Examples are as follows:
$url =index.php;
echo " ";
?>
---------------------------------------------------------------------------------------------------------------
PHP Self-bringing function
Header ("Location:www.php.com");
?>
Using meta
echo " >

PHP page jump Several implementation methods

Ha? Are you sure? Header (' Location:index.php '); I often write so that the page jumps to the homepage. Is index.php this not a relative path?
In addition, such as the header (' location:test/test113.php '), such a notation is also possible.

Perhaps you are mistaken, when the header is written relative to the path, relative to the execution of the script. Like I'm in
Write in test.php under the Include folder

Then use the test2.php in the another folder to include it

At this time to visit test2.php, go to the another below the index.php
When you visit test.php, you go to the index.php that include below

——————————————— Split Line ——————————————————
Please accept (⊙o⊙), the above is the soft and hard the team to bring you the answer.
If there is anything that can be asked, what questions can you ask me or ask my team questions. (*^__^*) hehe ...

http://www.bkjia.com/PHPjc/904016.html www.bkjia.com true http://www.bkjia.com/PHPjc/904016.html techarticle PHP page to implement the method of timed jump, PHP page Jump This example tells the PHP page to implement a timed jump method, share to everyone for your reference. The specific implementation method is as follows: Php set ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.