php connection_status函数用于返回当前的连接状态,其语法是connection_status(),返回值是返回连接状态位字段。
php connection_status函数怎么用?
定义和用法
connection_status() 函数返回当前的连接状态。
可返回的可能值:
立即学习“PHP免费学习笔记(深入)”;
0 - CONNECTION_NORMAL - 连接运行正常
1 - CONNECTION_ABORTED - 连接由用户或网络错误终止
2 - CONNECTION_TIMEOUT - 连接超时
3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT
语法
connection_status()
返回值: 返回连接状态位字段。
PHP 版本: 4+
实例
返回连接状态:
<?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; ?>
以上就是php connection_status函数怎么用的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号