Class Multipart
Diese Klasse Multipart bildet einen zusammengesetzten Inhaltstyp ab. Multipart besteht aus mehreren unabhängigen Inhaltstypen.
In dem Beispiel werden Daten per Multipart-Body an den Server übergeben.
// Neuer Multipart-Typ $form = new Alvine\Types\Mime\Multipart(); $uuid = (string) \Alvine\Util\UUID::generateFromRandom(); $href = 'cid:1.urn:uuid:'.$uuid; $part1Part = new \Alvine\Types\Mime\Text((string) 'Erster Inhalt'); // Header des Part1 Elements $part1Header = (new \Alvine\Net\Http\RequestHeader()) ->setValue('Content-Type', 'application/xop+xml; charset=UTF-8; type="text/xml"') ->setValue('Content-Transfer-Encoding', 'binary') ->setValue('Content-ID', '<0.urn:uuid:'.$uuid.'>'); $part2Part = new \Alvine\Types\Mime\Text('Zweiter Inhalt'); // Header des Part2 Elements $part2Header = (new \Alvine\Net\Http\RequestHeader())->setValue('Content-Type', 'application/octet-stream') ->setValue('Content-Transfer-Encoding', 'binary')->setValue('Content-ID', '<1.urn:uuid:'.$uuid.'>'); // Parts hinzufügen $form->addPart($part1Part, $part1Header); $form->addPart($part2Part, $part2Header); $body = new \Alvine\Net\Http\Body($form); echo (string) $body;
Dieser Code erzeugt folgende Ausgabe
--AlvineBoundarye85beeb8 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.urn:uuid:56092b06-0811-4714-b130-054c89dc6ed2> Erster Inhalt --AlvineBoundarye85beeb8 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-ID: <1.urn:uuid:56092b06-0811-4714-b130-054c89dc6ed2> Zweiter Inhalt --AlvineBoundarye85beeb8--
- Alvine\Core\Alvine implements Serializable uses Alvine\Core\SerializableImplementation
- Alvine\Types\Mime\MIMEType
- Alvine\Types\Mime\Part
- Alvine\Types\Mime\Content
- Alvine\Types\Mime\Multipart
Direct known subclasses
Alvine\Types\Mime\Multipart\Related
Namespace: Alvine\Types\Mime
Package: Alvine\Types\Mime
Category: Framework
License: Licence
Author: schukai GmbH info@schukai.de
Version: Release: $Revision: 1619 $
Since: 20110904
Link: Alvine
Located at types/mime/Multipart.class.php
Package: Alvine\Types\Mime
Category: Framework
License: Licence
Author: schukai GmbH info@schukai.de
Version: Release: $Revision: 1619 $
Since: 20110904
Link: Alvine
Located at types/mime/Multipart.class.php
public
|
#
__construct( string $content = null, string $subtype =
Erstellt ein neues MIME-Inhaltsobjekt für andere Teile. Wird ein Inhalt übergeben (!=null) so wird ein erster Teil hinzugefügt. |
public
string
|
|
public
|
|
public
Alvine\Types\Collection<\Alvine\Types\Mime\Content>
|
|
public
string
|
getEncodedContent(),
getEncoding(),
setEncoding()
|
getInstance()
|
getDefaultMimeType(),
getMimeType(),
getSubType(),
getType()
|
__call(),
__clone(),
__get(),
__set(),
equals(),
getClass(),
getClone(),
getClosure(),
getHashCode(),
getID(),
getShortID(),
isCallable(),
isInstanceOf(),
propertyExists()
|
serialize(),
unserialize()
|
checkAndAdjustSerialisation(),
serialize(),
unserialize()
|
string |
FORMDATA
Formulardaten |
#
'form-data'
|
string |
MIXED
mixed |
#
'mixed'
|
BASE64,
BINARY,
BIT8,
GZIP,
ORIGINAL,
QUOTEDPRINTABLE
|
APPLICATION,
APPLICATION_KEY,
AUDIO,
AUDIO_KEY,
DEFAULT_KEY,
IMAGE,
IMAGE_KEY,
MESSAGE,
MESSAGE_KEY,
MODEL,
MODEL_KEY,
MULTIPART,
MULTIPART_KEY,
OTHER,
OTHER_KEY,
TEXT,
TEXT_KEY,
VIDEO,
VIDEO_KEY
|
APIVERSION,
IDENTIFICATION,
SERIALVERSION,
VERSION
|
protected
string
|
$boundary
Trennung |
|
protected
Alvine\Types\Collection<\Alvine\Types\Mime\Content>
|
$parts
Liste mit den Bestanteilen |
$content,
$encoding
|
$subtype,
$type,
$typeMap
|
$hash,
$properties
|