例
返回连接萨特斯:
<?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其它参考