Swoole\Http\Response->write

Declaration

<?php
Swoole\Http\Response->write(string $data)

Parameters

data

HTTP body The max length of the data by default is 2M

Return

Response

Description

Enable chunk feature of Http to send data to client. Check the reference material about chunk feature of HTTP.

This method must be called before the $response->end method.

After the call of $response->end(), it would send a chunk of length 0 to end data transmission.

Example