本文整理匯總了PHP中Magento\Framework\App\RequestInterface::getHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP RequestInterface::getHeader方法的具體用法?PHP RequestInterface::getHeader怎麽用?PHP RequestInterface::getHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\App\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::getHeader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setAcceptType
/**
* Getting requested accept type
*
* @return void
*/
protected function setAcceptType()
{
$this->acceptType = 'xml';
$rawAcceptType = $this->request->getHeader('Accept');
if (strpos($rawAcceptType, 'json') !== false) {
$this->acceptType = 'json';
} elseif (strpos($rawAcceptType, 'html') !== false) {
$this->acceptType = 'html';
}
}
示例2: setAcceptType
/**
* Getting requested accept type
*
* @return void
*/
protected function setAcceptType()
{
$this->acceptType = 'html';
$rawAcceptType = $this->request->getHeader('Accept');
if ($this->request->getParam('isAjax') === 'true' || strpos($rawAcceptType, 'json') !== false) {
$this->acceptType = 'json';
} else {
if (strpos($rawAcceptType, 'html') !== false) {
$this->acceptType = 'html';
} else {
if (strpos($rawAcceptType, 'xml') !== false) {
$this->acceptType = 'xml';
}
}
}
}
示例3: prepareRequest
/**
* Process HTTP request object and prepare for token validation
*
* @param RequestInterface $httpRequest
* @return array
*/
public function prepareRequest($httpRequest)
{
$oauthParams = $this->_processRequest($httpRequest->getHeader('Authorization'), $httpRequest->getHeader(\Zend_Http_Client::CONTENT_TYPE), $httpRequest->getContent(), $this->getRequestUrl($httpRequest));
return $oauthParams;
}