This commit is contained in:
Patrick 2015-01-28 22:27:21 +01:00
commit 53d5731ffa

View file

@ -35,7 +35,7 @@ To actually send something back, you will also need to add the following snippet
```php ```php
foreach ($response->getHeaders() as $header) { foreach ($response->getHeaders() as $header) {
header($header); header($header, false);
} }
echo $response->getContent(); echo $response->getContent();
@ -43,6 +43,8 @@ echo $response->getContent();
This will send the response data to the browser. If you don't do this, nothing happens as the `Response` object only stores data. This is handled differently by most other HTTP components where the classes send data back to the browser as a side-effect, so keep that in mind if you use another component. This will send the response data to the browser. If you don't do this, nothing happens as the `Response` object only stores data. This is handled differently by most other HTTP components where the classes send data back to the browser as a side-effect, so keep that in mind if you use another component.
The second parameter of `header()` is false because otherwise existing headers will be overwritten.
Right now it is just sending an empty response back to the browser with the status code `200`; to change that, add the following code between the code snippets from above: Right now it is just sending an empty response back to the browser with the status code `200`; to change that, add the following code between the code snippets from above:
```php ```php