Skip to content

Instantly share code, notes, and snippets.

@AdamZWinter
Created May 12, 2020 01:14
Show Gist options
  • Select an option

  • Save AdamZWinter/865745e7e9a8f70536f97c316a616be2 to your computer and use it in GitHub Desktop.

Select an option

Save AdamZWinter/865745e7e9a8f70536f97c316a616be2 to your computer and use it in GitHub Desktop.

Revisions

  1. AdamZWinter created this gist May 12, 2020.
    15 changes: 15 additions & 0 deletions PHP Close Connection and Continue
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    // buffer all upcoming output
    ob_start();
    echo 'All done. Goodbye.';

    // get the size of the output
    $size = ob_get_length();

    // send headers to tell the browser to close the connection
    header("Content-Length: $size");
    header('Connection: close');

    // flush all output
    ob_end_flush();
    ob_flush();
    flush();