Javascript Ajax长轮询无法在中止时停止我的PHP脚本
开始我的JS和PHP代码 JS: 和PHPJavascript Ajax长轮询无法在中止时停止我的PHP脚本,javascript,php,ajax,long-polling,Javascript,Php,Ajax,Long Polling,开始我的JS和PHP代码 JS: 和PHP session_write_close(); ignore_user_abort(false); set_time_limit(60); header("Cache-Control: no-cache, must-revalidate"); while (true) { if ( connection_aborted() || connection_status() !=
session_write_close();
ignore_user_abort(false);
set_time_limit(60);
header("Cache-Control: no-cache, must-revalidate");
while (true) {
if ( connection_aborted() || connection_status() != CONNECTION_NORMAL ) { break; };
//do something... - check if file data is change - if change then return and break - whatever
sleep(1);
echo 'whatever';
wp_cache_flush();
ob_flush();
flush();
}
我的问题是,当JS stop/abort/timeout ajax请求并在PHP中打开新的上一个脚本not stop(在测试中,我特别为JS和PHP指定了不同的超时时间)并且仍然工作时,一些这样的操作杀死了我的服务器,而不是一个PHP操作,我有很多这样的操作
我尝试使用ignore_user_abort(true);-但不起作用。请帮忙-我做错了什么?我忘了什么
session_write_close();
ignore_user_abort(false);
set_time_limit(60);
header("Cache-Control: no-cache, must-revalidate");
while (true) {
if ( connection_aborted() || connection_status() != CONNECTION_NORMAL ) { break; };
//do something... - check if file data is change - if change then return and break - whatever
sleep(1);
echo 'whatever';
wp_cache_flush();
ob_flush();
flush();
}