本文整理汇总了PHP中Magento\Framework\App\Request\Http::getScheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::getScheme方法的具体用法?PHP Http::getScheme怎么用?PHP Http::getScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Request\Http
的用法示例。
在下文中一共展示了Http::getScheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirectToSetup
/**
* If not installed, try to redirect to installation wizard
*
* @param Bootstrap $bootstrap
* @param \Exception $exception
* @return void
* @throws \Exception
*/
private function redirectToSetup(Bootstrap $bootstrap, \Exception $exception)
{
$setupInfo = new SetupInfo($bootstrap->getParams());
$projectRoot = $this->_filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath();
if ($setupInfo->isAvailable()) {
$this->_response->setRedirect($setupInfo->getUrl());
$this->_response->sendHeaders();
} else {
$newMessage = $exception->getMessage() . "\nNOTE: You cannot install Magento using the Setup Wizard " . "because the Magento setup directory cannot be accessed. \n" . 'You can install Magento using either the command line or you must restore access ' . 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n";
$newMessage .= 'If you are using the sample nginx configuration, please go to ' . $this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $setupInfo->getUrl();
throw new \Exception($newMessage, 0, $exception);
}
}
示例2: _isBaseUrlCorrect
/**
* Check if base url enabled
*
* @param array $uri
* @param \Magento\Framework\App\Request\Http $request
* @return bool
*/
protected function _isBaseUrlCorrect($uri, $request)
{
$requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
}
示例3: execute
/**
* Performs verification.
*
* @param array $uri
* @param \Magento\Framework\App\Request\Http $request
* @return bool
*/
public function execute($uri, $request)
{
$requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
}