Skip to content

Instantly share code, notes, and snippets.

@alexpts
Last active November 19, 2019 19:40
Show Gist options
  • Save alexpts/fbacb2364b4190a244a22528d2c17c17 to your computer and use it in GitHub Desktop.
Save alexpts/fbacb2364b4190a244a22528d2c17c17 to your computer and use it in GitHub Desktop.
test_zend_emitter.php
<?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