php connection_status函數用於傳回目前的連線狀態,其語法是connection_status(),傳回值是傳回連線狀態位元欄位。
php connection_status函數怎麼用?
定義與用法
connection_status() 函數傳回目前的連線狀態。
可傳回的可能值:
0 - CONNECTION_NORMAL - 連線運作正常
##1 - CONNECTION_ABORTED - 連線由使用者或網路錯誤終止2 - CONNECTION_TIMEOUT - 連線逾時3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT語法#
connection_status()
實例
#傳回連線狀態:<?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中文網其他相關文章!