php判断客户端浏览器是否已经断开连接

<? php
date_default_timezone_set(
' asia/shanghai ' );
$starttime   =   date ( ' h:i:s ' );
set_time_limit ( 30 );
echo   ' ignore_user_abort: ' . ignore_user_abort () . ' <br> ' ;
ignore_user_abort ( true );
echo   ' ignore_user_abort: ' . ignore_user_abort () . ' <br> ' ;
$i = 1 ;
while ( 1 ){
    
if ( ! connection_aborted ()){
        
echo   " hello!!!--$i<br> " ;
        
ob_flush ();
        
flush ();
        
sleep ( 1 );
        
$i ++ ;
    }
else {
        
$endtime   =   date ( ' h:i:s ' );
        
$status   =   ' seconds: ' . " $i  connection status: " . connection_status () . "  connection_aborted: " . connection_aborted ();
        
file_put_contents ( ' stop.txt ' , " $starttime -> $endtime : stop  $status " );
        
exit ();
    }
}
?>
 

你可能感兴趣的:(PHP,Date,timezone,浏览器,File,user)