本文整理匯總了PHP中Buzz\Message\Request::getHost方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getHost方法的具體用法?PHP Request::getHost怎麽用?PHP Request::getHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Buzz\Message\Request
的用法示例。
在下文中一共展示了Request::getHost方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFromUrlAcceptsPort
public function testFromUrlAcceptsPort()
{
$request = new Request();
$request->fromUrl('http://localhost:3000/foo');
$this->assertEquals('http://localhost:3000', $request->getHost());
$this->assertEquals('/foo', $request->getResource());
}
示例2: processSetCookieHeaders
/**
* Processes Set-Cookie headers from a request/response pair.
*
* @param Message\Request $request A request object
* @param Message\Response $response A response object
*/
public function processSetCookieHeaders(Message\Request $request, Message\Response $response)
{
foreach ($response->getHeader('Set-Cookie', false) as $header) {
$cookie = new Cookie();
$cookie->fromSetCookieHeader($header, parse_url($request->getHost(), PHP_URL_HOST));
$this->addCookie($cookie);
}
}
示例3: matchesRequest
/**
* Returns true if the current cookie matches the supplied request.
*
* @return boolean
*/
public function matchesRequest(Message\Request $request)
{
// domain
if (!$this->matchesDomain(parse_url($request->getHost(), PHP_URL_HOST))) {
return false;
}
// path
if (!$this->matchesPath($request->getResource())) {
return false;
}
// secure
if ($this->hasAttribute(static::ATTR_SECURE) && !$request->isSecure()) {
return false;
}
return true;
}
示例4: makeDataToSign
protected function makeDataToSign(Request $request, $authHeader)
{
$url = parse_url($request->getHost());
$data = [$request->getMethod(), $url['scheme'], $url['host'], $request->getResource(), $this->getCanonicalHeaders($request), $this->makeContentHash($request), $authHeader];
$dataToSign = implode("\t", $data);
// echo 'data to sign:' . $dataToSign . "\n";
return $dataToSign;
}