connection_status

(PHP 4, PHP 5, PHP 7, PHP 8)

connection_statusBağlantı durumu bit maskesini döndürür

Açıklama

connection_status(): int

Bağlantı durumu bit maskesini döndürür.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Bağlantı durumu bit maskesini döndürür. Bağlantı durumunu saptamak için CONNECTION_* sabitleri bitsel işleçlerle ayrıştırılmalıdır.

Ayrıca Bakınız

  • connection_aborted() - İstemcinin bağlantıyı terkedip terketmediğine bakar
  • ignore_user_abort() - Bir istemci bağlantıyı terkettiğinde betiğin sonlandırılıp sonlandırılmayacağını belirler
  • PHP'nin bağlantıları nasıl yönettiği Bağlantı yönetimi sayfasında ayrıntılı olarak açıklanmıştır.

add a note

User Contributed Notes 2 notes

up
37
toppi at kacke dot de
21 years ago
Notice !if you running a loop (while, foeach etc..)  you have to send something to the browser to check the status.Example:while(1){    if (connection_status()!=0){    die;    }}doesnt work, if the user break/close the browser.But a:while(1){    Echo "\n"; //<-- send this to the client    if (connection_status()!=0){    die;    }}will work :)i hope it will help some of you to safe some time :)Toppi
up
11
Anonymous
5 years ago
As mentioned, this function returns a status bitfield to which there's a set of constants available. I don't know why those constants aren't actually listed. Although they're easy to guess, I think it's still worth listing them, it is documentation after all. This function has the ability to return integers 0 through 3 so there are 4 possible states.The constants are as follows:CONNECTION_NORMAL = 0CONNECTION_ABORTED = 1CONNECTION_TIMEOUT = 2As a 4th state is possible and being a bitfield, this gives rise to CONNECTION_ABORTED|CONNECTION_TIMEOUT (or integer 3) can be used to check for aborted+timeout states.
To Top