本文整理汇总了PHP中HttpStatus::getStatusMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpStatus::getStatusMessage方法的具体用法?PHP HttpStatus::getStatusMessage怎么用?PHP HttpStatus::getStatusMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpStatus
的用法示例。
在下文中一共展示了HttpStatus::getStatusMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setStatus
function setStatus(HttpStatus $status)
{
$protocol = $this->request ? $this->request->getProtocol() : 'HTTP/1.0';
header($protocol . ' ' . $status->getValue() . ' ' . $status->getStatusMessage(), true);
}
示例2: _sendResponse
public function _sendResponse($status = 200, $body = '', $content_type = 'text/html')
{
$statusMessage = HttpStatus::getStatusMessage($status);
// set the status
$status_header = 'HTTP/1.1 ' . $status . ' ' . $statusMessage;
header($status_header);
header('Content-type: ' . $content_type);
// pages with body are easy
if ($body != '') {
// send the body
echo CJSON::encode($body);
exit;
} else {
$data = array();
$data['status'] = $status;
$data['statusMessage'] = $statusMessage;
// create some body messages
$data['message'] = HttpStatus::getResponse($status);
// servers don't always have a signature turned on
// (this is an apache directive "ServerSignature On")
$data['signature'] = $_SERVER['SERVER_SIGNATURE'] == '' ? $_SERVER['SERVER_SOFTWARE'] . ' Server at ' . $_SERVER['SERVER_NAME'] . ' Port ' . $_SERVER['SERVER_PORT'] : $_SERVER['SERVER_SIGNATURE'];
$this->renderPartial('application.views.http._htmlResponse', array('data' => $data));
exit;
}
}