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


PHP HTTP_Request2_Response::getVersion方法代碼示例

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


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

示例1: testParseStatusLine

 /**
  *
  * @expectedException HTTP_Request2_MessageException
  */
 public function testParseStatusLine()
 {
     $response = new HTTP_Request2_Response('HTTP/1.1 200 OK');
     $this->assertEquals('1.1', $response->getVersion());
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals('OK', $response->getReasonPhrase());
     $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!');
     $this->assertEquals('1.2', $response2->getVersion());
     $this->assertEquals(222, $response2->getStatus());
     $this->assertEquals('Nishtyak!', $response2->getReasonPhrase());
     $response3 = new HTTP_Request2_Response('Invalid status line');
 }
開發者ID:Geeklog-Core,項目名稱:geeklog,代碼行數:16,代碼來源:ResponseTest.php

示例2: testParseStatusLine

 public function testParseStatusLine()
 {
     $response = new HTTP_Request2_Response('HTTP/1.1 200 OK');
     $this->assertEquals('1.1', $response->getVersion());
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals('OK', $response->getReasonPhrase());
     $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!');
     $this->assertEquals('1.2', $response2->getVersion());
     $this->assertEquals(222, $response2->getStatus());
     $this->assertEquals('Nishtyak!', $response2->getReasonPhrase());
     try {
         $response3 = new HTTP_Request2_Response('Invalid status line');
     } catch (HTTP_Request2_Exception $e) {
         return;
     }
     $this->fail('Expected HTTP_Request2_Exception was not thrown');
 }
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:17,代碼來源:ResponseTest.php

示例3: canKeepAlive

 /**
  * Checks whether current connection may be reused or should be closed
  *
  * @param    boolean                 whether connection could be persistent
  *                                   in the first place
  * @param    HTTP_Request2_Response  response object to check
  * @return   boolean
  */
 protected function canKeepAlive($requestKeepAlive, HTTP_Request2_Response $response)
 {
     // Do not close socket on successful CONNECT request
     if (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod() && 200 <= $response->getStatus() && 300 > $response->getStatus()) {
         return true;
     }
     $lengthKnown = 'chunked' == strtolower($response->getHeader('transfer-encoding')) || null !== $response->getHeader('content-length') || HTTP_Request2::METHOD_HEAD == $this->request->getMethod() || in_array($response->getStatus(), array(204, 304));
     $persistent = 'keep-alive' == strtolower($response->getHeader('connection')) || null === $response->getHeader('connection') && '1.1' == $response->getVersion();
     return $requestKeepAlive && $lengthKnown && $persistent;
 }
開發者ID:verbazend,項目名稱:AWFA,代碼行數:18,代碼來源:Socket.php


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