本文整理汇总了PHP中Swift_Message::detach方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Message::detach方法的具体用法?PHP Swift_Message::detach怎么用?PHP Swift_Message::detach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::detach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flushAttachments
/**
* Clear out all attachments
* @return boolean
*/
public function flushAttachments()
{
$success = true;
foreach ($this->attachmentIds as $id) {
try {
$this->message->detach($id);
} catch (Swift_Message_MimeException $e) {
$success = false;
$this->setError("An attachment failed to detach due to the error:<br />" . $e->getMessage());
}
}
$this->attachmentIds = array();
return $success;
}
示例2: flushAttachments
/**
* Clear out all attachments
* @return boolean
*/
function flushAttachments()
{
$success = true;
foreach ($this->attachmentIds as $id) {
Swift_Errors::expect($e, "Swift_Message_MimeException");
$this->message->detach($id);
if ($e) {
$success = false;
$this->setError("An attachment failed to detach due to the error:<br />" . $e->getMessage());
}
$e = null;
Swift_Errors::clear("Swift_Message_MimeException");
}
$this->attachmentIds = array();
return $success;
}
示例3: testRemovingAllSubParts
/**
* Removing all subParts should give a multipart/mixed message with a nested multipart/related document.
*/
public function testRemovingAllSubParts()
{
$msg = new Swift_Message();
$id1 = $msg->attach(new Swift_Message_Attachment("bar"));
$id2 = $msg->attach(new Swift_Message_EmbeddedFile("foo"));
$id3 = $msg->attach(new Swift_Message_Part("test"));
$msg->detach($id3);
$structure = $msg->build()->readFull();
//$this->dump($structure);
$this->assertNoPattern("~Content-Type: multipart/alternative~", $structure);
$this->assertPattern("~.*?Content-Type: multipart/mixed;\\s* boundary=(\"?)(.*?)\\1\r\n" . ".*?\r\n\r\n" . ".*?\r\n--\\2\r\n" . "Content-Type: multipart/related;\\s* boundary=(\"?)(.*?)\\3\r\n" . ".*?\r\n\r\n" . ".*?\r\n--\\4\r\n" . ".*?\r\n--\\4--" . "\\s*\r\n--\\2\r\n" . ".*?\r\n\r\n" . ".*?\r\n--\\2--~s", $structure);
}
示例4: detach
/**
* {@inheritdoc}
*
* @return $this|self
*/
public function detach(\Swift_Mime_MimeEntity $entity) : self
{
$this->message->detach($entity);
return $this;
}