本文整理匯總了PHP中Slim\Http\Request::hasHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::hasHeader方法的具體用法?PHP Request::hasHeader怎麽用?PHP Request::hasHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slim\Http\Request
的用法示例。
在下文中一共展示了Request::hasHeader方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}