appendContents() public method

Add to the body contents of this part.
public appendContents ( mixed $contents, $options = [] )
$contents mixed The part body. Either a string or a stream resource, or an array containing both. - encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value. - usestream: (boolean) If $contents is a stream, should we directly use that stream? DEFAULT: $contents copied to a new stream.
コード例 #1
0
ファイル: PartTest.php プロジェクト: x59/horde-mime
 public function testAppendContents()
 {
     $part = new Horde_Mime_Part();
     $part->appendContents('1');
     $this->assertEquals('1', $part->getContents());
     $part->appendContents('2');
     $this->assertEquals('12', $part->getContents());
     $tmp = fopen('php://temp', 'r+');
     fwrite($tmp, '3');
     rewind($tmp);
     $part->appendContents($tmp);
     $this->assertEquals('123', $part->getContents());
     $tmp = fopen('php://temp', 'r+');
     fwrite($tmp, '5');
     rewind($tmp);
     $part->appendContents(array('4', $tmp, '6'));
     $this->assertEquals('123456', $part->getContents());
 }