Signatur
stream_get_contents(resource $stream, ?int $length = null, int $offset = -1): string|false
Beschreibung
Praktisch nach fseek() oder für php://input.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $stream Pflicht | resource | — | Handle. |
| $length | ?int | null | Max. Bytes. |
| $offset | int | -1 | Offset in Bytes. |
Rückgabewert
Typ
string|false
Beschreibung
Inhalt.
Beispiele
Request-Body lesen
<?php
$body = stream_get_contents(fopen('php://input', 'r'));
// oder kürzer:
$body = file_get_contents('php://input');