本文整理匯總了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;
}
}