<?php
declare(ticks = 1);
$timeStart = time();
function checkTimeout () {
global $timeStart;
$seconds = 1;
if (time() - $timeStart > $seconds) {
exit ('超時' . "\n");
}
}
register_tick_function('checkTimeout');
while (1) {
echo '1<br>';
}