本文整理汇总了PHP中OCP\IRequest::getServerHost方法的典型用法代码示例。如果您正苦于以下问题:PHP IRequest::getServerHost方法的具体用法?PHP IRequest::getServerHost怎么用?PHP IRequest::getServerHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IRequest
的用法示例。
在下文中一共展示了IRequest::getServerHost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateHeaders
/**
* @param array $headers
* @param bool $hasMoreActivities
* @return array
*/
protected function generateHeaders(array $headers, $hasMoreActivities)
{
if ($hasMoreActivities && isset($headers['X-Activity-Last-Given'])) {
// Set the "Link" header for the next page
$nextPageParameters = ['since' => $headers['X-Activity-Last-Given'], 'limit' => $this->limit, 'sort' => $this->sort];
if ($this->objectType && $this->objectId) {
$nextPageParameters['object_type'] = $this->objectType;
$nextPageParameters['object_id'] = $this->objectId;
}
if ($this->request->getParam('format') !== null) {
$nextPageParameters['format'] = $this->request->getParam('format');
}
$nextPage = $this->request->getServerProtocol();
# http
$nextPage .= '://' . $this->request->getServerHost();
# localhost
$nextPage .= $this->request->getScriptName();
# /ocs/v2.php
$nextPage .= $this->request->getPathInfo();
# /apps/activity/api/v2/activity
$nextPage .= '?' . http_build_query($nextPageParameters);
$headers['Link'] = '<' . $nextPage . '>; rel="next"';
}
return $headers;
}