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


PHP HTTP_Request2::getHeaders方法代碼示例

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


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

示例1: testUpload

 public function testUpload()
 {
     $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST);
     $req->addUpload('upload', dirname(__FILE__) . '/_files/plaintext.txt');
     $headers = $req->getHeaders();
     $this->assertEquals('multipart/form-data', $headers['content-type']);
     try {
         $req->addUpload('upload_2', 'missing file');
     } catch (HTTP_Request2_Exception $e) {
         return;
     }
     $this->fail('Expected HTTP_Request2_Exception was not thrown');
 }
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:13,代碼來源:Request2Test.php

示例2: testAddCookieToJar

 public function testAddCookieToJar()
 {
     $req = new HTTP_Request2();
     $req->setCookieJar();
     try {
         $req->addCookie('foo', 'bar');
         $this->fail('Expected HTTP_Request2_Exception was not thrown');
     } catch (HTTP_Request2_LogicException $e) {
     }
     $req->setUrl('http://example.com/path/file.php');
     $req->addCookie('foo', 'bar');
     $this->assertArrayNotHasKey('cookie', $req->getHeaders());
     $cookies = $req->getCookieJar()->getAll();
     $this->assertEquals(array('name' => 'foo', 'value' => 'bar', 'domain' => 'example.com', 'path' => '/path/', 'expires' => null, 'secure' => false), $cookies[0]);
 }
開發者ID:SuhitNarayan,項目名稱:SuhitNarayan-SEMANTICTECH,代碼行數:15,代碼來源:Request2Test.php

示例3: getHeaders

 /**
  * Gets request's headers. The returned array key (header names) are all in
  * lower case even if they were set having some upper letters.
  *
  * @return array
  */
 public function getHeaders()
 {
     return $this->_request->getHeaders();
 }
開發者ID:southworkscom,項目名稱:azure-sdk-for-php,代碼行數:10,代碼來源:HttpClient.php

示例4: sendRequest

 public function sendRequest(HTTP_Request2 $request)
 {
     $this->requests[] = array('config' => $request->getConfig(), 'url' => $request->getUrl(), 'method' => $request->getMethod(), 'headers' => $request->getHeaders(), 'auth' => $request->getAuth(), 'body' => (string) $request->getBody());
     return parent::sendRequest($request);
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:5,代碼來源:TraceHttpAdapter.php


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