PHP flush()ฟังก์ชั่น
❮ ฟังก์ชั่นการควบคุมเอาต์พุต PHP
ตัวอย่าง
ส่งออกสตริงไปยังเบราว์เซอร์ก่อนที่สคริปต์จะทำงานเสร็จ:
<?php
// Some browsers will not display the content if it is too short
// We use str_pad() to make the output long enough
echo str_pad("Hello
World!", 4096);
// Use flush() to send the string to the browser
flush();
// Display the rest of the content three seconds later
sleep(3);
echo "<br>";
echo "Hello World!";
?>
ความหมายและการใช้งาน
ฟังก์ชัน นี้flush()
ขอให้เซิร์ฟเวอร์ส่งเอาต์พุตที่บัฟเฟอร์ปัจจุบันไปยังเบราว์เซอร์ การกำหนดค่าเซิร์ฟเวอร์อาจไม่อนุญาตให้สิ่งนี้เกิดขึ้นเสมอไป
ไวยากรณ์
flush();
รายละเอียดทางเทคนิค
รุ่น PHP: | 4+ |
---|
❮ ฟังก์ชั่นการควบคุมเอาต์พุต PHP