>  기사  >  php教程  >  send函数: PHP常用函数之send_http_status():输出常见HTTP状态信息

send函数: PHP常用函数之send_http_status():输出常见HTTP状态信息

WBOY
WBOY원래의
2016-06-21 08:49:391801검색

/**
* 输出常见HTTP状态信息
* @param integer $code 状态码
*/
function send_http_status($code) {
$status = array(
200 => 'OK',
301 => 'Moved Permanently',
302 => 'Moved Temporarily ',
400 => 'Bad Request',
401 => 'Unauthorized',
403 => 'Forbidden',
404 => 'Not Found',
500 => 'Internal Server Error',
503 => 'Service Unavailable',
);
$str = isset($status[$code]) ? (' ' . $status[$code]) : '';
header("HTTP/1.1 $code$str");
}
本文链接http://www.cxybl.com/html/wlbc/Php/20130607/38422.html



성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.