PHP connection_aborted () function
Examples
Create a function (check_abort ()), writes a log message when the client terminates the 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");
?>
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");
?>
Definition and Usage
connection_aborted () function checks whether the client is disconnected.
grammar
connection_aborted()
technical details
return value: | If the connection is terminated returns 1, otherwise it returns 0. |
---|---|
PHP version: | 4+ |
PHP Misc Reference Manual