PHP Класс Aerys\Body

Applications are invoked as soon as headers are received and before entity body data is parsed. The $request->body instance allows applications to await receipt of the full body (buffer) or stream it in chunks as it arrives. Buffering Example: $responder = function(Request $request, Response $response) { $bufferedBody = yield $request->getBody(); $response->send("Echoing back the request body: {$bufferedBody}"); }; Streaming Example: $responder = function(Request $request, Response $response) { $payload = ""; $body = $request->getBody() while (yield $body->valid()) { $payload .= $body->consume(); } $response->send("Echoing back the request body: {$payload}"); };
Наследование: extends Amp\PromiseStream, implements Amp\Promise
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Amp\Promise $promise )
watch ( callable $func, $data = null )
when ( callable $func, $data = null )

Описание методов

__construct() публичный метод

public __construct ( Amp\Promise $promise )
$promise Amp\Promise

watch() публичный метод

public watch ( callable $func, $data = null )
$func callable

when() публичный метод

public when ( callable $func, $data = null )
$func callable