本文整理汇总了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));
}