PHP 教程 PHP 表单 PHP 高级教程 PHP 数据库 PHP XML PHP 与 AJAX PHP 参考手册

发布于 2016-11-18 14:40:15 | 67 次阅读 | 评论: 0 | 来源: 网络整理

实例

创建一个函数(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+


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务