How to redirect to another page after 5 minutes?

后端 未结 3 1560
盖世英雄少女心
盖世英雄少女心 2020-12-17 23:55

How do I redirect to another page after 5 minutes using PHP?

相关标签:
3条回答
  • 2020-12-18 00:09

    With just HTML:

    <meta http-equiv="refresh" content="300;http://redirect-url" />
    

    This will redirect to http://redirect-url after 300 seconds (5 minutes).

    0 讨论(0)
  • 2020-12-18 00:22

    Javascript's setTimeout() is probably what you want. An example would be:

    setTimeout(function(){ window.location = "<URL HERE>";}, 5*60*1000);
    

    window.location is what you can use in javascript to set the current location of the window. Something to consider, however, is that most browsers do not let you set window.location without some type of user input before hand, such as a click.

    See here

    0 讨论(0)
  • 2020-12-18 00:25

    If you really want to use PHP for this, here you go:

    <?php header("Refresh: 300; URL=http://www.stackoverflow.com/"); ?>
    
    0 讨论(0)
提交回复
热议问题