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


PHP Sabre_HTTP_Request::getRawServerValue方法代码示例

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


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

示例1: guessBaseUri

 /**
  * This method attempts to detect the base uri.
  * Only the PATH_INFO variable is considered.
  *
  * If this variable is not set, the root (/) is assumed.
  *
  * @return string
  */
 public function guessBaseUri()
 {
     $pathInfo = $this->httpRequest->getRawServerValue('PATH_INFO');
     $uri = $this->httpRequest->getRawServerValue('REQUEST_URI');
     // If PATH_INFO is found, we can assume it's accurate.
     if (!empty($pathInfo)) {
         // We need to make sure we ignore the QUERY_STRING part
         if ($pos = strpos($uri, '?')) {
             $uri = substr($uri, 0, $pos);
         }
         // PATH_INFO is only set for urls, such as: /example.php/path
         // in that case PATH_INFO contains '/path'.
         // Note that REQUEST_URI is percent encoded, while PATH_INFO is
         // not, Therefore they are only comparable if we first decode
         // REQUEST_INFO as well.
         $decodedUri = Sabre_DAV_URLUtil::decodePath($uri);
         // A simple sanity check:
         if (substr($decodedUri, strlen($decodedUri) - strlen($pathInfo)) === $pathInfo) {
             $baseUri = substr($decodedUri, 0, strlen($decodedUri) - strlen($pathInfo));
             return rtrim($baseUri, '/') . '/';
         }
         throw new Sabre_DAV_Exception('The REQUEST_URI (' . $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
     }
     // The last fallback is that we're just going to assume the server root.
     return '/';
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:34,代码来源:Server.php


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