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; ?>