本文整理匯總了PHP中Part::getParts方法的典型用法代碼示例。如果您正苦於以下問題:PHP Part::getParts方法的具體用法?PHP Part::getParts怎麽用?PHP Part::getParts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Part
的用法示例。
在下文中一共展示了Part::getParts方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doParseBoundary
private function doParseBoundary($boundary)
{
$result = array();
$prefix = "--" . $boundary;
$this->consumeRegexp("/\n*/");
$this->consumeTo($prefix);
$this->consume($prefix);
while ($this->expects("\n")) {
$content = $this->consumeTo("\n" . $prefix);
$part = new Part();
$part->loadSource($content);
if ($part->isMultipart()) {
$result += $part->getParts();
} else {
$result[] = $part;
}
$this->consume("\n" . $prefix);
}
return $result;
}
示例2: testEmailBase64
/**
* Test a email document with base64 encoding
*/
public function testEmailBase64()
{
$content = file_get_contents(__DIR__ . '/../../data/email_base64.txt');
$part = new Part($content);
self::assertTrue($part->isMultiPart());
$this->setExpectedException('\\LogicException', "MultiPart content, there aren't body");
$part->getBody();
self::assertEquals('This is thé subject', $part->getHeader('Subject'));
/** @var Part[] $parts */
$parts = $part->getParts();
self::assertEquals('This is the content', $parts[0]->getBody());
self::assertEquals('This is the côntént', $parts[1]->getBody());
}