Ist es möglich, das es nach dem Aufruf abzubrechen:Abbrechen einen Header (Refresh)
<?php
// Start output while creating profile
if (ob_get_level() == 0) ob_start();
for ($i = 0; $i<1; $i++)
{
// Redirect user and download the profile
header('Refresh: .02; download.php');
echo "You're profile is being created, please wait...";
ob_flush();
flush();
sleep(1);
}
ob_end_flush();
// Start creating the profile
// Start this after the code above due to the long execution time
if(!createProfile())
{
// If createProfile returns false, cancel redirect and stop execution
cancelRedirect();
// Inform the user about the problem
echo 'Error!';
exit;
}
?>
Die Absicht ist, dass die header()
-function aufgerufen wird, dann wird das Skript etwas tut, und wenn das Ergebnis nicht wie erwartet Die Weiterleitung auf "download.php" sollte abgebrochen werden.
Logisch, es macht keinen Sinn. – Marcus
Das ist der einzige Weg das zu tun, weil 'echo' etwas vor dem Aufruf der 'header()' Funktion nicht funktioniert. – alve89
Es gibt 'header_remove()' obwohl. – mario