PHP connection_aborted() 函數
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");
?>
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 變量
- PHP 數據類型
- PHP 命名空間 namespace
- PHP array_column() 函數
- PHP array_filter() 函數
- PHP array_intersect_key() 函數
- PHP array_pad() 函數
- PHP array_product() 函數
- PHP array_push() 函數
- PHP array_splice() 函數
- PHP array_sum() 函數
- PHP array_udiff_uassoc() 函數
- PHP arsort() 函數
- PHP current() 函數
- PHP natcasesort() 函數
- PHP next() 函數
- PHP uksort() 函數
- PHP cURL 函數
- PHP 5 Date/Time 函數
- PHP Error 和 Logging 函數