本文整理汇总了PHP中HTTP::getMessageForCode方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::getMessageForCode方法的具体用法?PHP HTTP::getMessageForCode怎么用?PHP HTTP::getMessageForCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::getMessageForCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$this->requireSettings();
$responsecode = 200;
if ($this->data['errorcode'] > 0) {
$responsecode = $this->data['errorcode'];
} elseif ($this->data['statuscode'] > 0) {
$responsecode = $this->data['statuscode'];
} elseif ($this->data['errornumber'] > 0) {
$responsecode = $this->data['errornumber'];
}
$displaydata = $this->prepareResponseStructure();
if ($responsecode != 200) {
$http = new HTTP();
$message = $http->getMessageForCode($responsecode);
header("HTTP/1.0 " . $responsecode . " " . $message);
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($displaydata);
return true;
}
示例2: display
public function display()
{
$html = $this->getHTML();
if (!$this->options['headerssent']) {
if ($this->options['statuscode'] > 0 && $this->options['statuscode'] != 200) {
$http = new HTTP();
$message = $http->getMessageForCode($this->options['statuscode']);
header("HTTP/1.0 " . $this->options['statuscode'] . " " . $message);
}
header('Content-Type: text/html; charset=utf-8');
}
echo $html;
return true;
}