本文整理汇总了PHP中Nette\Http\IResponse::getHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP IResponse::getHeaders方法的具体用法?PHP IResponse::getHeaders怎么用?PHP IResponse::getHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Http\IResponse
的用法示例。
在下文中一共展示了IResponse::getHeaders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send JSONP response to output
* @param IRequest $httpRequest
* @param IResponse $httpResponse
* @throws \Drahak\Restful\InvalidArgumentException
*/
public function send(IRequest $httpRequest, IResponse $httpResponse)
{
$httpResponse->setContentType($this->contentType ? $this->contentType : 'application/javascript', 'UTF-8');
$data = array();
$data['response'] = $this->data;
$data['status'] = $httpResponse->getCode();
$data['headers'] = $httpResponse->getHeaders();
$callback = $httpRequest->getQuery('jsonp') ? Strings::webalize($httpRequest->getQuery('jsonp'), NULL, FALSE) : '';
echo $callback . '(' . $this->mapper->stringify($data, $this->isPrettyPrint()) . ');';
}
示例2: clearHeaders
/**
* Clears all http headers
* @param IResponse $res
* @return IResponse
*/
static function clearHeaders(IResponse $res, $setContentType = false)
{
$res->setCode(IResponse::S200_OK);
foreach ($res->getHeaders() as $key => $val) {
$res->setHeader($key, null);
}
if ($setContentType === true) {
$res->setContentType("text/html", "UTF-8");
}
return $res;
}