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


PHP Request::createFromServerArray方法代碼示例

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


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

示例1: request

 /**
  * Makes a request, and returns a response object.
  *
  * You can either pass an instance of Sabre\HTTP\Request, or an array,
  * which will then be used as the _SERVER array.
  *
  * @param array|\Sabre\HTTP\Request $request
  * @return \Sabre\HTTP\Response
  */
 function request($request)
 {
     if (is_array($request)) {
         $request = HTTP\Request::createFromServerArray($request);
     }
     $this->server->httpRequest = $request;
     $this->server->httpResponse = new HTTP\ResponseMock();
     $this->server->exec();
     return $this->server->httpResponse;
 }
開發者ID:Befox,項目名稱:cdav,代碼行數:19,代碼來源:DAVServerTest.php

示例2: request

 /**
  * Makes a request, and returns a response object.
  *
  * You can either pass an instance of Sabre\HTTP\Request, or an array,
  * which will then be used as the _SERVER array.
  *
  * If $expectedStatus is set, we'll compare it with the HTTP status of
  * the returned response. If it doesn't match, we'll immediately fail
  * the test.
  *
  * @param array|\Sabre\HTTP\Request $request
  * @param int $expectedStatus
  * @return \Sabre\HTTP\Response
  */
 function request($request, $expectedStatus = null)
 {
     if (is_array($request)) {
         $request = HTTP\Request::createFromServerArray($request);
     }
     $response = new HTTP\ResponseMock();
     $this->server->httpRequest = $request;
     $this->server->httpResponse = $response;
     $this->server->exec();
     if ($expectedStatus) {
         $responseBody = $expectedStatus !== $response->getStatus() ? $response->getBodyAsString() : '';
         $this->assertEquals($expectedStatus, $response->getStatus(), 'Incorrect HTTP status received for request. Response body: ' . $responseBody);
     }
     return $this->server->httpResponse;
 }
開發者ID:BlaBlaNet,項目名稱:hubzilla,代碼行數:29,代碼來源:DAVServerTest.php


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