Last active
November 19, 2019 19:40
-
-
Save alexpts/fbacb2364b4190a244a22528d2c17c17 to your computer and use it in GitHub Desktop.
test_zend_emitter.php
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 | |
$response = new JsonResponse(['message' => 'ok'], 200, [ | |
'header-1' => 'via reponse' | |
]); | |
$emitter = new SapiEmitter; | |
ob_start(); | |
header('header-2: via global `header()` method'); // add header to buffer from global | |
ob_get_clean(); | |
$emitter->emit($response); // send to client header-1 and header-2, but $response has only header-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment