Est-il possible d'annuler cette après l'appeler:Annuler un en-tête (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;
}
?>
L'intention est que le header()
-fonction est appelé, le script fait quelque chose et si le résultat est pas comme prévu la redirection vers "download.php" doit être annulée.
Logiquement, cela n'a aucun sens. – Marcus
C'est la seule façon de le faire car 'echo' quelque chose avant d'appeler la fonction' header() 'ne fonctionne pas. – alve89
Il existe cependant 'header_remove()'. – mario