http\Response
[mdref/mdref-http] / http / Env / Response / __invoke.md
1 # bool http\Response::__invoke(string $data[, int $ob_flags = 0])
2
3 Output buffer handler.
4 Appends output data to the body.
5
6 ## Params:
7
8 * string $data
9 The data output.
10 * Optional int $ob_flags = 0
11 Output buffering flags passed from the output buffering control layer.
12
13 ## Returns:
14
15 * bool, success.
16
17 ## Example:
18
19 <?php
20 $res = new http\Env\Response;
21 $res->setContentType("text/plain");
22
23 ob_start($res);
24 // yeah, well
25 // not the greatest application logic...
26 echo "Hello world!\n";
27
28 $res->send();
29 ?>
30
31 Yields:
32
33 Accept-Ranges: bytes
34 X-Powered-By: PHP/5.5.5
35 Content-Type: text/plain
36 ETag: "b2a9e441"
37
38 Hello world!