例
返回連接薩特斯:
<?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;
?>
運行示例» 定義和用法
該connection_status()函數返回當前連接狀態。
可以返回的值可能為:
- 0 - CONNECTION_NORMAL - 連接運行正常
- 1 - CONNECTION_ABORTED - 連接是由用戶或網絡錯誤中止
- 2 - CONNECTION_TIMEOUT - 連接超時
- 3 - CONNECTION_ABORTED&CONNECTION_TIMEOUT
句法
connection_status()
技術細節
返回值: | 返回連接狀態位域 |
---|---|
PHP版本: | 4+ |
<PHP其它參考