Getting a php script to pause

Discussion in 'PHP' started by liam1412, Sep 24, 2008.

  1. #1
    Is there a way to get php to pause mid script before processing.

    In pseudo-code what I am looking for is

    Any help is much appreciated.
     
    liam1412, Sep 24, 2008 IP
  2. piehead2000

    piehead2000 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    sleep(10);
    header("Location: http://www.google.com");
    ?>
     
    piehead2000, Sep 24, 2008 IP
  3. piehead2000

    piehead2000 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That will basically make the page take 10 seconds to load, if you want to load the page then redirect in 10 seconds then you need to use javascript setTimeout or a meta refresh
     
    piehead2000, Sep 24, 2008 IP
  4. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Just realised it's gonna give a screwy error output already sent shit......

    Any way to get round this.
     
    liam1412, Sep 24, 2008 IP
  5. piehead2000

    piehead2000 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    try using output buffering
     
    piehead2000, Sep 24, 2008 IP
  6. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #6
    use ob_start() and ob_flush() combo
     
    serialCoder, Sep 24, 2008 IP