當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。