Fonction PHP connection_aborted()
Exemple
Créez une fonction (check_abort()) qui écrit un message de journal si un client abandonne le script :
<?php
function check_abort()
{
if (connection_aborted())
error_log ("Script $GLOBALS[SCRIPT_NAME]" .
"$GLOBALS[SERVER_NAME] was aborted by the user.");
}
// Some script to be executed here
// Call the check_abort function when the script ends
register_shutdown_function("check_abort");
?>
Définition et utilisation
La fonction connection_aborted() vérifie si le client s'est déconnecté.
Syntaxe
connection_aborted()
Détails techniques
Valeur de retour : | Renvoie 1 si la connexion a été interrompue, sinon il renvoie 0 |
---|---|
Version PHP : | 4+ |
❮ Référence Divers PHP