如何检测web服务客户端断开nusoap php

时间:2016-07-01 14:22:25

标签: php web-services client nusoap disconnection

如何在php中检测客户端断开连接。我有一个使用nusoap库的Web服务,我想检测Web服务客户端断开连接。 我尝试使用此代码:

ignore_user_abort(true);            // Continue running the script even when the client aborts/disconnects
ob_flush();
flush();                           // Clean PHP's output buffer
usleep(500000);                     
echo "0\r\n\r\n"; 
ob_flush();                         // Clean output buffer
flush();                            // Clean PHP's output buffer
if(connection_aborted() != 0) {     
        //do something
}

它有效但有2个问题:

  • Flush()函数添加额外的标头导致此警告:警告:无法修改标头信息 - 已在。\ lib \ nusoap-0_9_5 \ lib \ nusoap.php中发送的标题...
  • 由于我发送echo" 0 \ r \ n \ r \ n" 0 \ r \ n \ n \ r \ n"我的网络服务的响应格式不正确检查客户端连接。

如何解决上面列出的问题?还有其他方法可以检测Web服务客户端断开连接吗? 感谢

0 个答案:

没有答案