クライアントがスクリプトを切断した場合に、ログメッセージを書き込む関数(check_abort())を作成します:
<?php
function check_abort()
{
if (connection_aborted())
error_log ("Script $GLOBALS[SCRIPT_NAME]" .
"$GLOBALS[SERVER_NAME] was aborted by the user.");
}
// Some script to be executed here
// Call the check_abort function when the script ends
register_shutdown_function("check_abort");
?>
connection_aborted() 関数は、クライアントとの接続が切断されているかどうかをチェックします。
connection_aborted()
返り値: | クライアントとの接続が切断されている場合には 1 を、それ以外の場合は 0 を返します |
---|---|
PHP バージョン: | 4+ |