PHP 7.2.25 Released


(PHP 4, PHP 5, PHP 7)

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


connection_status ( void ) : int

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

Dönen Değerler

Bağlantı durumu bit maskesini döndürür. Bağlantı durumunu saptamak için CONNECTION_XXX sabitlerini bitsel işleçlerle ayrıştırın.

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 add a note

User Contributed Notes 3 notes

toppi at kacke dot de
15 years ago
Notice !

if you running a loop (while, foeach etc..)  you have to send something to the browser to check the status.


    if (connection_status()!=0){
doesnt work, if the user break/close the browser.

But a:

    Echo "\n"; //<-- send this to the client
    if (connection_status()!=0){
will work :)

i hope it will help some of you to safe some time :)

14 years ago
Yes it is true. I made some experiments with that functions 'connection_abortes()'. First a source made an error, which I see. They wrote: ignore_user_abort();

But that only gives you the status of the 'Abort-Setting'.
So I try (with little hope)
And as I readout the setting it has changed it...

Next I see that the script runs after I disconnect with the site. But other experiments fail. I try some things and then it
was logical after an experiment: flush() is one of the necessary things. Without those output to the client the function
          'connection_aborted()' stays on 'false'
The Second is that you have to output something. Without that it also doesn't works.
So I now know that you have to echo something and then output the buffer. Only then 'the Script' (or the function)
'knows' that the client is disconnected.
jorge dot hebrard at gmail dot com
10 years ago
You can always send chr(0) to check if browser is still alive, that will show no output in browser page (at least in Firefox).
To Top