本文整理匯總了PHP中Sabre\DAV\URLUtil::decodePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP URLUtil::decodePath方法的具體用法?PHP URLUtil::decodePath怎麽用?PHP URLUtil::decodePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sabre\DAV\URLUtil
的用法示例。
在下文中一共展示了URLUtil::decodePath方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: calculateUri
/**
* Calculates the uri for a request, making sure that the base uri is stripped out
*
* @param string $uri
* @throws Exception\Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri
* @return string
*/
public function calculateUri($uri)
{
if ($uri[0] != '/' && strpos($uri, '://')) {
$uri = parse_url($uri, PHP_URL_PATH);
}
$uri = str_replace('//', '/', $uri);
if (strpos($uri, $this->getBaseUri()) === 0) {
return trim(URLUtil::decodePath(substr($uri, strlen($this->getBaseUri()))), '/');
// A special case, if the baseUri was accessed without a trailing
// slash, we'll accept it as well.
} elseif ($uri . '/' === $this->getBaseUri()) {
return '';
} else {
throw new Exception\Forbidden('Requested uri (' . $uri . ') is out of base uri (' . $this->getBaseUri() . ')');
}
}