本文整理匯總了PHP中Slim\Http\Request::getRootUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getRootUri方法的具體用法?PHP Request::getRootUri怎麽用?PHP Request::getRootUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slim\Http\Request
的用法示例。
在下文中一共展示了Request::getRootUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRequestPaths
public static function getRequestPaths(\Slim\Http\Request $request)
{
$basePath = $request->getRootUri();
if ($basePath === '' || substr($basePath, -1) != '/') {
$basePath .= '/';
}
$host = $request->getHost();
$protocol = $request->getScheme();
$requestUri = $request->getRootUri() . $request->getResourceUri();
return array('basePath' => $basePath, 'host' => $host, 'protocol' => $protocol, 'fullBasePath' => $protocol . '://' . $host . $basePath, 'requestUri' => $requestUri, 'fullUri' => $protocol . '://' . $host . $requestUri);
}
示例2: defaultNotFound
/**
* Default Not Found handler
*/
protected function defaultNotFound()
{
echo self::generateTemplateMarkup('404 Page Not Found', '<p>The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.</p><a href="' . $this->request->getRootUri() . '/">Visit the Home Page</a>');
}
示例3: asset
/**
* @param string $path
* @return string
*/
public function asset($path)
{
return preg_replace('#/+#', '/', sprintf('%s%s', dirname($this->request->getRootUri()), $path));
}