Created
July 27, 2012 06:15
-
-
Save microweber/3186437 to your computer and use it in GitHub Desktop.
php background tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ignore_user_abort(); | |
set_time_limit(0); | |
ob_start(); // This is required | |
include 'somefile.php'; | |
echo $someString; | |
$content_size = ob_get_length(); | |
$content = ob_get_contents(); | |
ob_end_clean(); | |
header( 'Content-Length: ' . $content_size ); | |
header( 'Connection: close' ); | |
echo $content; | |
flush(); | |
// The browser should no longer show the page loading bar and should | |
// consider the page fully loaded. Nothing else that you output will | |
// be displayed to the user | |
echo "I'm never seen!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment