本文整理汇总了PHP中Slim\Http\Request::getHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getHeader方法的具体用法?PHP Request::getHeader怎么用?PHP Request::getHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Http\Request
的用法示例。
在下文中一共展示了Request::getHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goBack
public function goBack()
{
if ($this->request->hasHeader('HTTP_REFERER')) {
$referer = $this->request->getHeader('HTTP_REFERER')[0];
return $this->response->withRedirect($referer, 301);
}
return $this->goHome();
}
示例2: checkPartialUpload
/**
* Checks if request headers are partial upload headers
*
* @param Request $slRequest Slim request object
*
* @return boolean
*/
public static function checkPartialUpload(\Slim\Http\Request $slRequest)
{
if ($slRequest->hasHeader('Content-Type') === true) {
$contentType = $slRequest->getHeader('Content-Type');
if (stripos($contentType[0], static::HEADERMULTI) !== false) {
$posBoundary = stripos($contentType[0], static::BOUNDARYSPLIT);
$posBoundary = $posBoundary + strlen(static::BOUNDARYSPLIT);
return static::FIXEDBOUNDARY . substr($contentType[0], $posBoundary);
}
}
return false;
}
示例3: has_access
function has_access(\Slim\Http\Request $request)
{
try {
$receivedKey = $request->getHeader('key');
} catch (Exception $e) {
error_log($e->getMessage());
}
if ($receivedKey != null && strcmp($receivedKey[0], $_SERVER['key']) == 0) {
return true;
}
return false;
}