PHP中Header使用的HTTP协议的状态码对照_PHP教程

php中文网
发布: 2016-07-21 14:58:52
原创
1301人浏览过

php
/**
* http protocol defined status codes
* http协议状态码,调用函数时候只需要将$num赋予一个下表中的已知值就直接会返回状态了。
* @param int $num
* downloads by http://www.bkjia.com
*/
function https($num) {
$http = array (
100 => "http/1.1 100 continue",
101 => "http/1.1 101 switching protocols",
200 => "http/1.1 200 ok",
201 => "http/1.1 201 created",
202 => "http/1.1 202 accepted",
203 => "http/1.1 203 non-authoritative information",
204 => "http/1.1 204 no content",
205 => "http/1.1 205 reset content",
206 => "http/1.1 206 partial content",
300 => "http/1.1 300 multiple choices",
301 => "http/1.1 301 moved permanently",
302 => "http/1.1 302 found",
303 => "http/1.1 303 see other",
304 => "http/1.1 304 not modified",
305 => "http/1.1 305 use proxy",
307 => "http/1.1 307 temporary redirect",
400 => "http/1.1 400 bad request",
401 => "http/1.1 401 unauthorized",
402 => "http/1.1 402 payment required",
403 => "http/1.1 403 forbidden",
404 => "http/1.1 404 not found",
405 => "http/1.1 405 method not allowed",
406 => "http/1.1 406 not acceptable",
407 => "http/1.1 407 proxy authentication required",
408 => "http/1.1 408 request time-out",
409 => "http/1.1 409 conflict",
410 => "http/1.1 410 gone",
411 => "http/1.1 411 length required",
412 => "http/1.1 412 precondition failed",
413 => "http/1.1 413 request entity too large",
414 => "http/1.1 414 request-uri too large",
415 => "http/1.1 415 unsupported media type",
416 => "http/1.1 416 requested range not satisfiable",
417 => "http/1.1 417 expectation failed",
500 => "http/1.1 500 internal server error",
501 => "http/1.1 501 not implemented",
502 => "http/1.1 502 bad gateway",
503 => "http/1.1 503 service unavailable",
504 => "http/1.1 504 gateway time-out"
);
header($http[$num]);
}
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/363776.htmlTechArticle?PHP /** * HTTP Protocol defined status codes * HTTP协议状态码,调用函数时候只需要将$num赋予一个下表中的已知值就直接会返回状态了。 * @param int $...
相关标签:
php
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号