- PHP 正则表达式(PCRE)
- PHP 图像处理
- PHP 5 Array 函数
- PHP 5 Calendar 函数
- PHP cURL 函数
- PHP 5 Date/Time 函数
- PHP 5 Directory 函数
- PHP Error 和 Logging 函数
- PHP 5 Filesystem 函数
- PHP Filter 函数
- PHP FTP 函数
- PHP HTTP 函数
- PHP Libxml 函数
- PHP Mail 函数
- PHP 5 Math 函数
- PHP 杂项 函数
- PHP 5 MySQLi 函数
- PHP 5 SimpleXML 函数
- PHP lcfirst() 函数
- PHP 5 String 函数
- PHP XML Parser 函数
- PHP Zip File 函数
- PHP 5 时区
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 Misc 参考手册
关注微信小程序
扫描二维码
程序员编程王