(PHP 4, PHP 5, PHP 7)
ignore_user_abort — 锟斤拷锟矫客伙拷锟剿断匡拷锟斤拷锟斤拷时锟角凤拷锟叫断脚憋拷锟斤拷执锟斤拷
$value
] ) : int锟斤拷锟矫客伙拷锟剿断匡拷锟斤拷锟斤拷时锟角凤拷锟叫断脚憋拷锟斤拷执锟斤拷
PHP 锟斤拷锟斤拷锟斤拷锟叫脚憋拷执锟斤拷时锟斤拷锟斤拷锟脚憋拷锟秸端斤拷锟斤拷锟斤拷锟脚憋拷锟斤拷锟结被锟斤拷锟斤拷锟斤拷止锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 value
为 TRUE
锟斤拷锟斤拷锟斤拷疟锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷时锟结被锟斤拷止锟斤拷
value
锟斤拷锟斤拷锟斤拷锟斤拷烁锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷 ignore_user_abort ini 锟斤拷值锟斤拷锟斤拷为 value
锟斤拷
锟斤拷锟轿达拷锟斤拷酶锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥憋拷锟斤拷锟矫o拷锟斤拷锟结返锟斤拷之前锟斤拷锟斤拷锟矫★拷
锟斤拷锟斤拷锟酵凤拷锟斤拷之前锟斤拷锟斤拷锟斤拷
Example #1 ignore_user_abort()锟斤拷锟斤拷
<?php
// Ignore user aborts and allow the script
// to run forever
ignore_user_abort(true);
set_time_limit(0);
echo 'Testing connection handling in PHP';
// Run a pointless loop that sometime
// hopefully will make us click away from
// page or click the "Stop" button.
while(1)
{
// Did the connection fail?
if(connection_status() != CONNECTION_NORMAL)
{
break;
}
// Sleep for 10 seconds
sleep(10);
}
// If this is reached, then the 'break'
// was triggered from inside the while loop
// So here we can log, or perform any other tasks
// we need without actually being dependent on the
// browser.
?>
锟斤拷PHP锟斤拷锟皆凤拷锟斤拷锟斤拷息锟斤拷锟酵伙拷锟斤拷之前锟斤拷锟斤拷锟斤拷锟解到锟矫伙拷锟角凤拷锟斤拷锟叫讹拷锟斤拷锟接★拷 锟斤拷使锟斤拷 echo 锟斤拷洳伙拷锟饺凤拷锟斤拷锟较拷逊锟斤拷停锟斤拷渭锟� flush() 锟斤拷锟斤拷锟斤拷