本文整理汇总了PHP中Magento\Framework\App\RequestInterface::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::getRequestUri方法的具体用法?PHP RequestInterface::getRequestUri怎么用?PHP RequestInterface::getRequestUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::getRequestUri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequestUri
/**
* Returns the REQUEST_URI taking into account
* platform differences between Apache and IIS
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getRequestUri($clean = false)
{
$uri = $this->_request->getRequestUri();
if ($clean) {
$uri = $this->_converter->cleanString($uri);
}
return $uri;
}
示例2: getCurrentUrl
/**
* Retrieve current url
*
* @return string
*/
public function getCurrentUrl()
{
$httpHostWithPort = $this->_request->getHttpHost(false);
$httpHostWithPort = explode(':', $httpHostWithPort);
$httpHost = isset($httpHostWithPort[0]) ? $httpHostWithPort[0] : '';
$port = '';
if (isset($httpHostWithPort[1])) {
$defaultPorts = [\Magento\Framework\App\Request\Http::DEFAULT_HTTP_PORT, \Magento\Framework\App\Request\Http::DEFAULT_HTTPS_PORT];
if (!in_array($httpHostWithPort[1], $defaultPorts)) {
/** Custom port */
$port = ':' . $httpHostWithPort[1];
}
}
return $this->_request->getScheme() . '://' . $httpHost . $port . $this->_request->getRequestUri();
}
示例3: _redirectIfNeededAfterLogin
/**
* Checks, whether Magento requires redirection after successful admin login, and redirects user, if needed
*
* @param \Magento\Framework\App\RequestInterface $request
* @return bool
*/
protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInterface $request)
{
$requestUri = null;
// Checks, whether secret key is required for admin access or request uri is explicitly set
if ($this->_url->useSecretKey()) {
$requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
} elseif ($request) {
$requestUri = $request->getRequestUri();
}
if (!$requestUri) {
return false;
}
$this->_response->setRedirect($requestUri);
$this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
return true;
}
示例4: getRequestUrl
/**
* Compute the request Url from the Http request
*
* @param RequestInterface $httpRequest
* @return string
*/
public function getRequestUrl($httpRequest)
{
return $httpRequest->getScheme() . '://' . $httpRequest->getHttpHost(false) . $httpRequest->getRequestUri();
}