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 Misc リファレンスマニュアル その他の拡張モジュール