超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<connection_abortedconnection_timeout>
Last updated: Fri, 22 Jun 2007

connection_status

(PHP 3>= 3.0.7, PHP 4 , PHP 5)

connection_status -- Returns connection status bitfield

Description

int connection_status ( void )

Returns the connection status bitfield. See the Connection Handling description in the Features chapter for a complete explanation.

See also connection_aborted(), and ignore_user_abort().




add a note add a note User Contributed Notes
connection_status
carlos at fischerinformatica dot com dot br
31-Jan-2002 10:58
Very very useful!
I was building a chat and I wanted my script to detect when the browser was closed, so the user could be deleted from the online_users table.

<?
echo str_repeat(" ",300);
ignore_user_abort(true); //this way, the user can stop the output, but not the script.
while (true) {
        echo "test
\n";
        flush();
        sleep(2);
      if (connection_status()!=0){
                include ('dbconnect.inc');
                $sql="delete from online_users where online_user=$user";
                $sql_exec=pg_exec($vChatDB, $sql);
                die(); //kills the script
        }
}
?>

<connection_abortedconnection_timeout>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22