本文整理匯總了PHP中Slim\Http\Headers::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Headers::get方法的具體用法?PHP Headers::get怎麽用?PHP Headers::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slim\Http\Headers
的用法示例。
在下文中一共展示了Headers::get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: header
/**
* DEPRECATION WARNING! Access `headers` property directly.
*
* Get and set header
* @param string $name Header name
* @param string|null $value Header value
* @return string Header value
*/
public function header($name, $value = null)
{
if (!is_null($value)) {
$this->headers->set($name, $value);
}
return $this->headers->get($name);
}
示例2: getUserAgent
/**
* Get User Agent
* @return string|null
*/
public function getUserAgent()
{
return $this->headers->get('HTTP_USER_AGENT');
}
示例3: getForwardingInfo
/**
* Return a UrlInfo instance if the request contains forwarding information, or null if not.
*
* First we look for the standard 'Forwarded' header from RFC 7239, then for the non-standard X-Forwarded-... headers.
*
* @param \Slim\Http\Headers $headers
* @return null|UrlInfo
*/
protected function getForwardingInfo(\Slim\Http\Headers $headers)
{
$info = null;
$forwarded = $headers->get('Forwarded');
if (!is_null($forwarded)) {
$info = new UrlInfo($forwarded);
} else {
$fhost = $headers->get('X-Forwarded-Host');
$fproto = $headers->get('X-Forwarded-Proto');
if (!is_null($fhost)) {
$info = new UrlInfo($fhost, $fproto);
}
}
return $info;
}
示例4: testGetNotExists
public function testGetNotExists()
{
$h = new Headers();
$this->assertNull($h->get('Foo'));
}