當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Headers::removeHeader方法代碼示例

本文整理匯總了PHP中Zend\Mail\Headers::removeHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Headers::removeHeader方法的具體用法?PHP Headers::removeHeader怎麽用?PHP Headers::removeHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Mail\Headers的用法示例。


在下文中一共展示了Headers::removeHeader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testRemoveHeaderWithInstanceWillRemoveThatInstance

 public function testRemoveHeaderWithInstanceWillRemoveThatInstance()
 {
     $headers = new Mail\Headers();
     $headers->addHeaders(array(array('Foo' => 'foo'), array('Foo' => 'bar'), 'Baz' => 'baz'));
     $header = $headers->get('foo')->current();
     $this->assertEquals(3, $headers->count());
     $headers->removeHeader($header);
     $this->assertEquals(2, $headers->count());
     $this->assertTrue($headers->has('foo'));
     $this->assertNotSame($header, $headers->get('foo'));
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:11,代碼來源:HeadersTest.php

示例2: testHeadersCanRemoveHeader

 public function testHeadersCanRemoveHeader()
 {
     $headers = new Headers();
     $headers->addHeaders(array('Foo' => 'bar', 'Baz' => 'baz'));
     $header = $headers->get('foo');
     $this->assertEquals(2, $headers->count());
     $headers->removeHeader($header);
     $this->assertEquals(1, $headers->count());
     $this->assertFalse($headers->get('foo'));
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:10,代碼來源:HeadersTest.php

示例3: mergeDuplicateHeader

 /**
  * Merge duplicate header fields into single headers field.
  * The headers must be AbstractAddressList.
  *
  * @param Headers $headerBag
  * @param HeaderInterface|AbstractAddressList[] $headers
  */
 private function mergeDuplicateHeader(Headers $headerBag, $headers)
 {
     if ($headers instanceof HeaderInterface) {
         // all good
         return;
     }
     // use first headers as base and collect addresses there
     $header = $headers[0];
     unset($headers[0]);
     if (!$header instanceof AbstractAddressList) {
         throw new DomainException(sprintf('Cannot grab address list from headers of type "%s"; not an AbstractAddressList implementation', get_class($header)));
     }
     $addressList = $header->getAddressList();
     foreach ($headers as $h) {
         $addressList->merge($h->getAddressList());
     }
     $headerBag->removeHeader($header->getFieldName());
     $headerBag->addHeader($header);
 }
開發者ID:dabielkabuto,項目名稱:eventum,代碼行數:26,代碼來源:SanitizeHeaders.php


注:本文中的Zend\Mail\Headers::removeHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。