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