Last active
October 20, 2015 13:53
-
-
Save sasezaki/33875978610a508c6f5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Diactoros\Response; | |
require_once __DIR__.'/vendor/autoload.php'; | |
$res = new Response(); | |
$res->getBody()->write('hello'); | |
$contents = $res->getBody()->getContents(); | |
var_dump($contents); // "" | |
$res->getBody()->seek(0); | |
$contents = $res->getBody()->getContents(); | |
var_dump($contents); // "hello" | |
$res->getBody()->seek(0); | |
$contents = $res->getBody()->getContents(); | |
var_dump($contents); // "hello" | |
$res->getBody()->seek(2); | |
$contents = $res->getBody(); | |
var_dump((string)$contents); // "hello" | |
$contents = $res->getBody()->getContents(); | |
var_dump($contents); // "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment