PHP Velho Oeste 2024

http_throttle

(PECL pecl_http >= 0.10.0)

http_throttleAceleración de HTTP

Descripción

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

Establece el retardo de la aceleración, y el tamaño de la memoria de envío.

Nota: Esta función debería ser utilizada en conjunción con http_send_data(), http_send_file() y http_send_stream().

Nota: Proporciona un mecanismo básico de regulación, que hará rendir el proceso o subproceso actual hasta que la entidad haya sido completamente enviada.

Nota:

Esto puede no funcionar como se espera en el(los) siguiente(s) SAPI(s): FastCGI.

Parámetros

sec

segundos de espera entre el envío de cada bloque

bytes

tamaño en bytes de los bloques

Ejemplos

Ejemplo #1 Ejemplo de http_throttle()

Enviar un fichero a aproximadamente 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');
?>

Ver también

add a note add a note

User Contributed Notes 1 note

up
3
dr dot sane at gmail dot com
13 years ago
Note that in the example when it says "Send file with approximately 20 kbyte/s." that is only an upper bound. The file could still be sent at a lesser speed (e.g. 10 kb/s) if the client, network, or server, cannot handle the amount.
To Top