PHP:Header
RFC2616有相关的所有的状态信息的说明, 就状态码,大体总结如下:
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received, understood,
- and accepted
- 3xx: Redirection - Further action must be taken in order to
- complete the request
- 4xx: Client Error - The request contains bad syntax or cannot be
- fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently
- valid request
状态码 | 含义 |
---|---|
100 | Continue 继续 |
101 | Switching Protocols 交换协议 |
200 | OK 好的 |
201 | Created 创建 |
202 | Accepted 接受 |
203 | Non-Authoritative Information 非授权信息 |
204 | No Content 没有内容 |
205 | Reset Content 重置内容 |
206 | Partial Content 部分内容 |
300 | Multiple Choices 多选 |
301 | Moved Permanently 永久移动 |
302 | Moved Temporarily 临时移动 |
303 | See Other 看到其他 |
304 | Not Modified 不修改 |
305 | Use Proxy 使用代理 |
400 | Bad Request 坏的请求 |
401 | Unauthorized 未经授权的 |
402 | Payment Required 付款要求 |
403 | Forbidden 被禁止的 |
404 | Not Found 没有找到 |
405 | Method Not Allowed 不允许 |
406 | Not Acceptable 不能接受的 |
407 | Proxy Authentication Required 需要代理认证 |
408 | Request Time-out 请求超时 |
409 | Conflict 冲突 |
410 | Gone 走了 |
411 | Length Required 长度要求 |
412 | Precondition Failed 失败的前提 |
413 | Request Entity Too Large 请求实体太大 |
414 | Request-URI Too Large 请求uri太大 |
415 | Unsupported Media Type 不支持的媒体类型 |
500 | Internal Server Error 服务器内部错误 |
501 | Not Implemented 没有实现 |
502 | Bad Gateway 坏的网关 |
503 | Service Unavailable 服务不可用 |
504 | Gateway Time-out 网关超时 |
505 | HTTP Version not supported 不支持HTTP版本 |
So, 举几个例子:
header("HTTP/1.1 404 Not Found", true, 404);
header("HTTP/1.0 401 Unauthorized");
header("Content-Type: text/html; charset=utf-8;");
header("Location:http://www.xxx.com");
RFC2616 http://www.faqs.org/rfcs/rfc2616
评论 (0)