定義和用法
connection_aborted() 函數檢查是否斷開客戶機。
如果已終止連接,則該函返回1,否則返回0。
語法
connection_aborted()
例子
創建一個函數,在客戶機終止腳本時寫入一條日誌消息:
<?php
function check_abort()
{if (connection_aborted()
error_log ("Script $GLOBALS[SCRIPT_NAME]" .
"$GLOBALS[SERVER_NAME] was aborted by the user.");
}
//要執行的一些代碼
// 在腳本結束時調用check_abort 函數
register_shutdown_function("check_abort");
?>
期待您的留言

Comments