Skip to content

Message: getBody Example

Terry L edited this page Jun 20, 2020 · 3 revisions

Shieldon\Psr7\Message

getBody()

Gets the body of the message.

  • return StreamInterface

Example:

$stream = $message->getBody();

// Assume the content is a HTML formatted string.
// getContent() is a method defined in StreamInterface.
echo $stream->getContents();

// Outputs: <html>...</html>
Clone this wiki locally