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