http_throttle

(PECL pecl_http >= 0.10.0)

http_throttleHTTP throttling

說明

void http_throttle ( float $sec [, int $bytes = 40960 ] )

Sets the throttle delay and send buffer size.

Note: 此函式應與 http_send_data(), http_send_file()http_send_stream() 一同使用。

Note: 提供基本的節流機制,會放棄當前程序或線程,直至實體已被完全發送。

Note:

下列 SAPI 可能不能正常的工作: FastCGI.

參數

sec

seconds to sleep after each chunk sent

bytes

the chunk size in bytes

範例

Example #1 A http_throttle() example

Send file with approximately 20 kbyte/s.

<?php
// ~ 20 kbyte/s
# http_throttle(1, 20000);
# http_throttle(0.5, 10000);
http_throttle(0.12000);
http_send_file('document.pdf');
?>

參見

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top