PHP connection_aborted() not working correctly

前端 未结 5 1255
北荒
北荒 2021-01-14 07:47

I have the following code:

ignore_user_abort(true);
while(!connection_aborted()) {
    // do stuff
}

and according to the PHP documentation

5条回答
  •  被撕碎了的回忆
    2021-01-14 07:52

    Try:

        ignore_user_abort(true);
    
        echo "Testing connection handling";
    
        while (1) {
                if (connection_status() != CONNECTION_NORMAL)
                        break;
                sleep(1);
                echo "test";
                flush();
        }
    

提交回复
热议问题