Reputation: 1103
By using this:
$size = ob_get_length();
header("Content-Length: $size");
header('Connection: close');
ob_end_flush();
ob_flush();
flush();
Along ignore_user_abort(true);
I get to receive with an ajax call a complete status and let the file handle server side without the user having to wait for a response for the contents of the file to be parsed.
I'd like to achieve the same but with a header("Location: target");
instead of header('Connection: close');
- so it looks as everything is finished but the file continues to parse after triggering header("Location: target");
What would be the right approach into letting the file to continue working but redirect the user with PHP.
By the way before five down votes in a row, the question is not duplicate of PHP Redirect User and Continue Process Script although the title seems to resemble this question.
Upvotes: 1
Views: 221
Reputation: 2452
no, it does not stop the execution but you can manually stop the execution with exit call
Upvotes: 0
Reputation: 21810
what would be the right approach into letting the file to continue working but redirect the user with PHP?
You're describing parallel processing with an immediate exit, which you'll have to fudge in PHP:
think of step two in the same way as you would if you were firing off an ajax request about which you didn't care about the response. it would be done in parallel to your parent page.
Upvotes: 1