connection_status()函数返回连接状态。
connection_status()
不适用
connection_status()函数返回以下可能的值。这是状态位字段-
0-CONNECTION_NORMAL-连接正常运行
1-CONNECTION_ABORTED-连接因用户或网络错误而中止
2-CONNECTION_TIMEOUT-连接超时
3-CONNECTION_ABORTED和CONNECTION_TIMEOUT
以下是一个例子-
<?php switch (connection_status()) { case CONNECTION_NORMAL: $msg = 'Connection is in a normal state!'; break; case CONNECTION_ABORTED: $msg = 'Connection aborted!'; break; case CONNECTION_TIMEOUT: $msg = 'Connection timed out!'; break; case (CONNECTION_ABORTED & CONNECTION_TIMEOUT): $msg = 'Connection aborted and timed out!'; break; default: $msg = 'Status is unknown!'; break; } echo $msg; ?>