PHP connection_aborted()関数
例
クライアントがスクリプトを中止した場合にログメッセージを書き込む関数(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歳以上 |
❮PHPその他のリファレンス