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


PHP UriInterface::getBasePath方法代码示例

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


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

示例1: getRequestTarget

 /**
  * Retrieves the message's request target.
  *
  * Retrieves the message's request-target either as it will appear (for
  * clients), as it appeared at request (for servers), or as it was
  * specified for the instance (see withRequestTarget()).
  *
  * In most cases, this will be the origin-form of the composed URI,
  * unless a value was provided to the concrete implementation (see
  * withRequestTarget() below).
  *
  * If no URI is available, and no request-target has been specifically
  * provided, this method MUST return the string "/".
  *
  * @return string
  */
 public function getRequestTarget()
 {
     if ($this->requestTarget) {
         return $this->requestTarget;
     }
     if ($this->uri === null) {
         return '/';
     }
     $path = $this->uri->getBasePath();
     $path .= $this->uri->getPath();
     $query = $this->uri->getQuery();
     if ($query) {
         $path .= '?' . $query;
     }
     $this->requestTarget = $path;
     return $this->requestTarget;
 }
开发者ID:Whiskey24,项目名称:GoingDutchApi,代码行数:33,代码来源:Request.php

示例2: getRequestTarget

 /**
  * Retrieves the message's request target.
  *
  * Retrieves the message's request-target either as it will appear (for
  * clients), as it appeared at request (for servers), or as it was
  * specified for the instance (see withRequestTarget()).
  *
  * In most cases, this will be the origin-form of the composed URI,
  * unless a value was provided to the concrete implementation (see
  * withRequestTarget() below).
  *
  * If no URI is available, and no request-target has been specifically
  * provided, this method MUST return the string "/".
  *
  * @return string
  */
 public function getRequestTarget()
 {
     if ($this->requestTarget) {
         return $this->requestTarget;
     }
     if ($this->uri === null) {
         return '/';
     }
     $basePath = method_exists($this->uri, 'getBasePath') ? $this->uri->getBasePath() : '';
     $path = $this->uri->getPath();
     $path = $basePath . '/' . ltrim($path, '/');
     $query = $this->uri->getQuery();
     if ($query) {
         $path .= '?' . $query;
     }
     $this->requestTarget = $path;
     return $this->requestTarget;
 }
开发者ID:control-corp,项目名称:micro,代码行数:34,代码来源:Request.php

示例3: basePath

 public function basePath()
 {
     return $this->uri->getBasePath();
 }
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:4,代码来源:PlatesUriExtension.php

示例4: extractPath

 /**
  * @param UriInterface $uri
  *
  * @return string
  */
 private function extractPath(UriInterface $uri)
 {
     // Slim3 compatibility
     if ($uri instanceof Uri) {
         $basePath = $uri->getBasePath();
         if (!empty($basePath)) {
             return $basePath;
         }
     }
     return $uri->getPath();
 }
开发者ID:php-middleware,项目名称:phpdebugbar,代码行数:16,代码来源:PhpDebugBarMiddleware.php


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