当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::addHeader方法代码示例

本文整理汇总了PHP中Buzz\Message\Response::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::addHeader方法的具体用法?PHP Response::addHeader怎么用?PHP Response::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Buzz\Message\Response的用法示例。


在下文中一共展示了Response::addHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testProcessSetCookieHeadersSetsCookies

 public function testProcessSetCookieHeadersSetsCookies()
 {
     $request = new Message\Request();
     $request->setHost('http://www.example.com');
     $response = new Message\Response();
     $response->addHeader('Set-Cookie: SESSION2=qwerty');
     $response->addHeader('Set-Cookie: SESSION1=asdf');
     $jar = new CookieJar();
     $jar->processSetCookieHeaders($request, $response);
     $cookies = $jar->getCookies();
     $this->assertEquals(2, count($cookies));
     foreach ($cookies as $cookie) {
         $this->assertEquals('www.example.com', $cookie->getAttribute(Cookie::ATTR_DOMAIN));
         $this->assertTrue(in_array($cookie->getName(), array('SESSION1', 'SESSION2')));
     }
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:16,代码来源:CookieJarTest.php

示例2: testGetReasonPhraseReturnsAMultiwordReasonPhrase

 public function testGetReasonPhraseReturnsAMultiwordReasonPhrase()
 {
     $response = new Response();
     $this->assertNull($response->getReasonPhrase());
     $response->addHeader('HTTP/1.0 500 Internal Server Error');
     $this->assertEquals('Internal Server Error', $response->getReasonPhrase());
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:7,代码来源:ResponseTest.php

示例3: createResponse

 protected function createResponse($content = '')
 {
     $response = new Buzz\Message\Response();
     $response->addHeader('1.0 200 OK');
     $response->setContent($content);
     return $response;
 }
开发者ID:pampy,项目名称:PiwikClient,代码行数:7,代码来源:HttpConnectionTest.php

示例4: testSetsResponseHeadersAndContent

 public function testSetsResponseHeadersAndContent()
 {
     $response = new Message\Response();
     $response->addHeader('HTTP/1.0 200 OK');
     $response->setContent('Hello World!');
     $client = new FIFO();
     $client->setQueue(array($response));
     $client->sendToQueue($response);
     $this->assertEquals(count($client->getQueue()), 2);
     $request = new Message\Request();
     $response = new Message\Response();
     $client->send($request, $response);
     $this->assertEquals(count($client->getQueue()), 1);
     $this->assertEquals($response->getHeaders(), array('HTTP/1.0 200 OK'));
     $this->assertEquals($response->getContent(), 'Hello World!');
 }
开发者ID:philip,项目名称:Buzz,代码行数:16,代码来源:FIFOTest.php

示例5: onResult

 /**
  * {@inheritDoc}
  */
 public function onResult(MultiCurl $client, RequestInterface $request, Response $response, array $options, $error)
 {
     if ($error !== CURLE_OK) {
         $response->addHeader(sprintf('X-Curl-Error-Result: %d', $error));
     }
 }
开发者ID:vaniocz,项目名称:VanioBuzzBundle,代码行数:9,代码来源:ErrorListener.php

示例6: createResponse

    /**
     * Create new Response.
     *
     * @param string $status  response status description
     * @param string $content content
     *
     * @return Message\Response
     */
    protected function createResponse($status, $content = null)
    {
        $response = new Message\Response();
        $response->addHeader($status);

        if (null !== $content) {
            $response->setContent($content);
        }

        return $response;
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:19,代码来源:ConnectionTest.php


注:本文中的Buzz\Message\Response::addHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。