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 การอ้างอิงเบ็ดเตล็ด