本文整理匯總了PHP中Slim\Http\Request::getScheme方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getScheme方法的具體用法?PHP Request::getScheme怎麽用?PHP Request::getScheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slim\Http\Request
的用法示例。
在下文中一共展示了Request::getScheme方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param Request $request
* @param Response $response
*/
public function __construct(Request $request, Response $response)
{
$this->scheme = $request->getScheme();
$this->host = $request->getHost();
$port = $request->getPort();
$this->response = $response;
if ('http' === $this->scheme && 80 !== $port) {
$this->host .= ':' . $port;
}
if ('https' === $this->scheme && 443 !== $port) {
$this->host .= ':' . $port;
}
}
示例2: 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);
}