PHPのCONNECTION_STATUS()関数
例
接続状態を返します。
<?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;
?>
実行中のインスタンス»
定義と使用法
CONNECTION_STATUS()関数は、現在の接続状態を返します。
可能な値を返すことができます。
- 0 - CONNECTION_NORMAL - 機能に接続されています
- 1 - CONNECTION_ABORTED - ユーザまたはネットワークによって終了接続エラー
- 2 - CONNECTION_TIMEOUT - 接続タイムアウト
- 3 - CONNECTION_ABORTED&CONNECTION_TIMEOUT
文法
connection_status()
技術的詳細
戻り値: | 接続ステータスのビットフィールドを返します。 |
---|---|
PHPバージョン: | 4+ |
PHPその他リファレンスマニュアル