Current Location: Home> Function Categories> connection_aborted

connection_aborted

Check if the client is disconnected
Name:connection_aborted
Category:Miscellaneous
Programming Language:php
One-line Description:Check if the client is disconnected.

Definition and usage

connection_aborted() function checks whether the client is disconnected.

If the connection has been terminated, the function returns 1, otherwise it returns 0.

Example

Create a function that 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 code to execute

// Call the check_abort function at the end of the script
register_shutdown_function ( "check_abort" ) ;
?>

grammar

 connection_aborted ( )
Similar Functions
Popular Articles