PHP connection_status() functie

Definitie en gebruik

De connection_status() functie retourneert de huidige connectiestatus.

Mogelijke teruggegeven waarden:

  • 0 - CONNECTION_NORMAL - Connection running normally
  • 1 - CONNECTION_ABORTED - Connection terminated by user or network error
  • 2 - CONNECTION_TIMEOUT - Connection timeout
  • 3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT

Syntax

connection_status()

Voorbeeld

<?php
switch (connection_status())
{
case CONNECTION_NORMAL:
   $txt = 'Connection is in a normal state';
   break;
case CONNECTION_ABORTED:
   $txt = 'Connection aborted';
   break;
case CONNECTION_TIMEOUT:
   $txt = 'Connection timed out';
   break;
case (CONNECTION_ABORTED & CONNECTION_TIMEOUT):
   $txt = 'Connection aborted and timed out';
   break;
default:
   $txt = 'Unknown';
   break;
}
echo $txt;
?>