PHP Redirect Pause

前端 未结 8 1205
北荒
北荒 2020-12-28 19:08

How do I pause a page for a certain amount of seconds before redirecting the user to another HTML/PHP page using PHP?

相关标签:
8条回答
  • 2020-12-28 19:58

    never use sleep this way. Even under slight load your server will run out of http connections. Worst if your firewall runs out.

    The delay parameter in the redirect header is made for exactly to the same reason.

    0 讨论(0)
  • 2020-12-28 20:10

    Update: this works, but may not be the most appropriate solution for this situation. See comments.

    Might this be what you are looking for?

    <?php
    sleep(5);
    header("Location: http://www.example.com/");
    exit();
    ?>
    
    0 讨论(0)
提交回复
热议问题