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


PHP Request::getUrl方法代码示例

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


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

示例1: testGetUrlFormatsAUrl

 public function testGetUrlFormatsAUrl()
 {
     $request = new Request();
     $request->setHost('http://example.com');
     $request->setResource('/resource/123');
     $this->assertEquals('http://example.com/resource/123', $request->getUrl());
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:7,代码来源:RequestTest.php

示例2: authenticate

 /**
  * Authenticate the request object. Apply the access_token to the URL
  *
  * TODO: implement
  * 
  * @param Request       $request        Request object to authenticate
  */
 public function authenticate(\Buzz\Message\Request $request)
 {
     $url = $request->getUrl();
     $prefix = strpos($url, '?') > 0 ? '&' : '?';
     $request->fromUrl($url . $prefix . 'access_token=' . $this->accessToken);
     return $request;
 }
开发者ID:puwenhan,项目名称:github-api3-php,代码行数:14,代码来源:OAuth.php

示例3: setCurlOptsFromRequest

 protected static function setCurlOptsFromRequest($curl, Message\Request $request)
 {
     curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getMethod());
     curl_setopt($curl, CURLOPT_URL, $request->getUrl());
     curl_setopt($curl, CURLOPT_HTTPHEADER, $request->getHeaders());
     curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getContent());
 }
开发者ID:richardmiller,项目名称:Linktuesday.com,代码行数:7,代码来源:Curl.php

示例4: factory

 /**
  * @param Request $request
  * @param Response $response
  * 
  * @return HttpException
  */
 public static function factory(Request $request, Response $response)
 {
     if ($response->isClientError()) {
         $label = 'Client error response';
     } elseif ($response->isServerError()) {
         $label = 'Server error response';
     } else {
         $label = 'Unsuccessful response';
     }
     $message = implode(PHP_EOL, array($label, '[status code] ' . $response->getStatusCode(), '[reason phrase] ' . $response->getReasonPhrase(), '[url] ' . $request->getUrl()));
     $e = new static($message, $response->getStatusCode());
     $e->setResponse($response);
     $e->setRequest($request);
     return $e;
 }
开发者ID:Studio-40,项目名称:Payum,代码行数:21,代码来源:HttpException.php

示例5: setCurlOptsFromRequest

 protected static function setCurlOptsFromRequest($curl, Message\Request $request)
 {
     $options = array(CURLOPT_CUSTOMREQUEST => $request->getMethod(), CURLOPT_URL => $request->getUrl(), CURLOPT_HTTPHEADER => $request->getHeaders(), CURLOPT_HTTPGET => false, CURLOPT_NOBODY => false, CURLOPT_POSTFIELDS => null);
     switch ($request->getMethod()) {
         case Message\Request::METHOD_HEAD:
             $options[CURLOPT_NOBODY] = true;
             break;
         case Message\Request::METHOD_GET:
             $options[CURLOPT_HTTPGET] = true;
             break;
         case Message\Request::METHOD_POST:
         case Message\Request::METHOD_PUT:
             $options[CURLOPT_POSTFIELDS] = $fields = self::getPostFields($request);
             // remove the content-type header
             if (is_array($fields)) {
                 $options[CURLOPT_HTTPHEADER] = array_filter($options[CURLOPT_HTTPHEADER], function ($header) {
                     return 0 !== strpos($header, 'Content-Type: ');
                 });
             }
             break;
     }
     curl_setopt_array($curl, $options);
 }
开发者ID:kingsj,项目名称:core,代码行数:23,代码来源:Curl.php

示例6: postSend

 public function postSend(Message\Request $request, Message\Response $response)
 {
     $seconds = microtime(true) - $this->startTime;
     call_user_func($this->logger, sprintf('%sSent "%s %s" in %dms', $this->prefix, $request->getMethod(), $request->getUrl(), round($seconds * 1000)));
 }
开发者ID:kingsj,项目名称:core,代码行数:5,代码来源:LoggerListener.php


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