PHP connection_status() 函数

PHP 教程 · 2019-01-27 11:26:22

实例

返回连接状态:

<?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 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Sprint

Sprint

Jake Knapp、John Zeratsky、Braden Kowitz / Simon & Schuster / 2016-3-8 / GBP 14.60

媒体推荐 “Every business leader I know worries about the same thing: Are we moving fast enough? The genius of Jake Knapp’s Sprint is its step-by-step breakdown of what it takes to solve big problems an......一起来看看 《Sprint》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具