0
我正在嘗試刷新輸出到瀏覽器,然後斷開MAC級別的用戶連接。然而,我的腳本實際上並沒有完成加載瀏覽器,它顯示加載,但元刷新不會變爲活動,直到這個頁面實際完成。他們可以做的任何功能都會完成輸出,並讓PHP自己完成任務,而無需掛斷用戶。強制文檔以PHP結尾
<?php
if (ob_get_level() == 0) {
ob_start();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Loading... </title>
<meta http-equiv="refresh" content="6;URL='nexturl.php'" />
</head>
<body>
<p>Loading... (lots of whitespace here)</p>
</body>
</html>
<?php
ob_flush();
flush();
ob_end_flush();
sleep(1);
// This function kills their connection on their computer instantly
disconnect_user_on_their_router();
?>
'exit;'?或者您需要在文檔結束後繼續使用PHP。 –
如果你想在沒有用戶注意的情況下運行PHP,你應該使用AJAX – Joren