8a2f8a743c2c71ed345c736641ec168e71efecc7
[mdref/mdref-http] / http / Message / Body / addPart.md
1 # http\Message\Body http\Message\Body::addPart(http\Message $part)
2
3 Add a part to a multipart body.
4
5 ## Params:
6
7 * http\Message $part
8 The message part.
9
10 ## Returns:
11
12 * http\Message\Body, self.
13
14 ## Example:
15
16 <?php
17 $multi = new http\Message\Body;
18 $multi->addPart(new http\Message("Content-type: text/plain\n\nHello part 1!"));
19 $multi->addPart(new http\Message("Content-type: text/plain\n\nHello part 2!"));
20
21 echo $multi;
22 ?>
23
24 Yields:
25
26 --8a72b190.3fe908df
27 Content-Type: text/plain
28 Content-Length: 13
29
30 Hello part 1!
31 --8a72b190.3fe908df
32 Content-Type: text/plain
33 Content-Length: 13
34
35 Hello part 2!
36 --8a72b190.3fe908df--