PHP connection_status()Funciones
Manual de referencia de PHP Misc
Ejemplos
Devuelve el estado de conexión:
<?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;
?>
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;
?>
Ejecutar ejemplo »
Definición y uso
La función connection_status() devuelve el estado de conexión actual.
Posibles valores de retorno:
- 0 - CONNECTION_NORMAL - la conexión se está ejecutando normalmente
- 1 - CONNECTION_ABORTED - la conexión fue terminada por el usuario o por un error de red
- 2 - CONNECTION_TIMEOUT - tiempo de espera de conexión agotado
- 3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT
Sintaxis
connection_status()
Detalles técnicos
| Valor de retorno: | Devuelve el campo de bits del estado de conexión. |
|---|---|
| Versión de PHP: | 4+ |
Manual de referencia de PHP Misc Otras extensiones