本文整理匯總了PHP中Phalcon\Http\Response::getHeaders方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::getHeaders方法的具體用法?PHP Response::getHeaders怎麽用?PHP Response::getHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\Http\Response
的用法示例。
在下文中一共展示了Response::getHeaders方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isRedirection
/**
* @param Response $response
*
* @return bool
*/
public function isRedirection($response)
{
$status = $response->getHeaders()->get('Status');
$code = (int) strstr($status, ' ', true);
return $code >= 300 && $code < 400;
}
示例2: getHeaders
public function getHeaders()
{
return parent::getHeaders();
}
示例3: parseResponseHeaders
protected function parseResponseHeaders(Response $response)
{
$headers = ['status' => '', 'headers' => [], 'set_cookies' => []];
// status
$headers['status'] = 'HTTP/1.1 ' . $response->getStatusCode();
// headers
foreach ($response->getHeaders()->toArray() as $name => $value) {
$headers['headers'][] = $name . ($value === null ? '' : ': ' . $value);
}
// cookies
foreach (Cookies::toArray() as $cookie) {
$headers['set_cookies'][] = [$cookie->getName(), $cookie->getResponseValue(), $cookie->getExpiration(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure(), $cookie->getHttpOnly()];
}
return $headers;
}