当前位置: 首页>>代码示例>>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;未经允许,请勿转载。