第一问题:ignore_user_abort这个函数是不是一定要在PHP.INI里设置成为ON才能运行?
第二个问题:如果第一个问题回答是必需要设置的话,那么ignore_user_abort这个函数还有没有其它的方法让其运行。
最后,我要实现的功能是:让用户关闭浏览器,这个.PHP文件也能正常运行。
下面是PHP的代码。有谁可以指点下的。
<?php
ignore_user_abort(true);
set_time_limit(0);
function test(){
$hosts = array("http://www.baidu.com", "http://www.google.com", "http://www.qq.com");
$timeout = 15;
$status = array();
$sockets = array();foreach ($hosts as $id => $host) {
$s = stream_socket_client("$host:80", $errno, $errstr, $timeout);
if ($s) {
 mail("[email protected]","bad connect","progress not in");
} else {
 mail("[email protected]","success connect","progress in");
}
}
}function do_cron(){
usleep(150000000);
test();
}while(1){
do_cron();
}
?>