This little code at the top of your file will let it run in the background until done, even if the user closes the page once it shows. It will also show this plain message instantly and nothing else. If you add ?show=true
to the end of the URL this script won't run so you can see the regular output.
<?php
if (!isset($_GET["show"])){
ob_end_clean();
header("Connection: close\\r\\n");
header("Content-Encoding: none\\r\\n");
ignore_user_abort(true);
ini_set('max_execution_time', 300);
ob_start();
echo ('We are going to do some work now but you are not allowed to see it!');
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
ob_end_clean();
}
Your code here!!!!