Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-21 08:49:39
Original
1807 people have browsed it

/**
* 输出常见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



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!