|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
|
在照彭武兴先生的《PHP BIBLE》中所述,header可以送出Status标头,如 mN2Linux联盟 <?phpmN2Linux联盟 mN2Linux联盟 header("Status: 404 Not Found"); mN2Linux联盟 mN2Linux联盟 ?> mN2Linux联盟 mN2Linux联盟 就可以让用户浏览器出现文件找不到的404错误,但是我试了这样是不行的。 mN2Linux联盟 mN2Linux联盟 后来我到w3.org上查了http的相关资料,终于试出来了如何Header出状态代码(Status),与大家分享。 mN2Linux联盟 mN2Linux联盟 其实应该是这样的: mN2Linux联盟 mN2Linux联盟 Header("http/1.1 403 Forbidden"); mN2Linux联盟 mN2Linux联盟 ?> mN2Linux联盟 mN2Linux联盟 第一部分为HTTP协议的版本(HTTP-Version) mN2Linux联盟 mN2Linux联盟 第二部分为状态代码(Status) mN2Linux联盟 mN2Linux联盟 第三部分为原因短语(Reason-Phrase) mN2Linux联盟 mN2Linux联盟 三部分中间用一个空格分开,且中间不能有回车,第一部分和第二部分是必需的,第三部分则是给人看的,可写可不写甚至乱写。 mN2Linux联盟 mN2Linux联盟 还有,这一句的输出必须在Html文件的第一行。 mN2Linux联盟 mN2Linux联盟 下面我给出各代码所代表的意思(是从w3.org上查到的,够权威了): mN2Linux联盟 mN2Linux联盟 * 1xx: Informational - Request received, continuing process mN2Linux联盟 mN2Linux联盟 * 2xx: Success - The action was successfully received, understood, mN2Linux联盟 mN2Linux联盟 and accepted mN2Linux联盟 mN2Linux联盟 * 3xx: Redirection - Further action must be taken in order to mN2Linux联盟 mN2Linux联盟 complete the request mN2Linux联盟 mN2Linux联盟 * 4xx: Client Error - The request contains bad syntax or cannot be mN2Linux联盟 mN2Linux联盟 fulfilled mN2Linux联盟 mN2Linux联盟 * 5xx: Server Error - The server failed to fulfill an apparently mN2Linux联盟 mN2Linux联盟 valid request mN2Linux联盟 mN2Linux联盟 mN2Linux联盟 | "100" ; Continue mN2Linux联盟 mN2Linux联盟 | "101" ; Switching Protocols mN2Linux联盟 mN2Linux联盟 | "200" ; OK mN2Linux联盟 mN2Linux联盟 | "201" ; Created mN2Linux联盟 mN2Linux联盟 | "202" ; Accepted mN2Linux联盟 mN2Linux联盟 | "203" ; Non-Authoritative Information mN2Linux联盟 mN2Linux联盟 | "204" ; No Content mN2Linux联盟 mN2Linux联盟 | "205" ; Reset Content mN2Linux联盟 mN2Linux联盟 | "206" ; Partial Content mN2Linux联盟 mN2Linux联盟 | "300" ; Multiple Choices mN2Linux联盟 mN2Linux联盟 | "301" ; Moved Permanently mN2Linux联盟 mN2Linux联盟 | "302" ; Moved Temporarily mN2Linux联盟 mN2Linux联盟 | "303" ; See Other mN2Linux联盟 mN2Linux联盟 | "304" ; Not Modified mN2Linux联盟 mN2Linux联盟 | "305" ; Use Proxy mN2Linux联盟 mN2Linux联盟 | "400" ; Bad Request mN2Linux联盟 mN2Linux联盟 | "401" ; Unauthorized mN2Linux联盟 mN2Linux联盟 | "402" ; Payment Required mN2Linux联盟 mN2Linux联盟 | "403" ; Forbidden mN2Linux联盟 mN2Linux联盟 | "404" ; Not Found mN2Linux联盟 mN2Linux联盟 | "405" ; Method Not Allowed mN2Linux联盟 mN2Linux联盟 | "406" ; Not Acceptable mN2Linux联盟 mN2Linux联盟 | "407" ; Proxy Authentication Required mN2Linux联盟 mN2Linux联盟 | "408" ; Request Time-out mN2Linux联盟 mN2Linux联盟 | "409" ; Conflict mN2Linux联盟 mN2Linux联盟 | "410" ; Gone mN2Linux联盟 mN2Linux联盟 | "411" ; Length Required mN2Linux联盟 mN2Linux联盟 | "412" ; Precondition Failed mN2Linux联盟 mN2Linux联盟 | "413" ; Request Entity Too Large mN2Linux联盟 mN2Linux联盟 | "414" ; Request-URI Too Large mN2Linux联盟 mN2Linux联盟 | "415" ; Unsupported Media Type mN2Linux联盟 mN2Linux联盟 | "500" ; Internal Server Error mN2Linux联盟 mN2Linux联盟 | "501" ; Not Implemented mN2Linux联盟 mN2Linux联盟 | "502" ; Bad Gateway mN2Linux联盟 mN2Linux联盟 | "503" ; Service Unavailable mN2Linux联盟 mN2Linux联盟 | "504" ; Gateway Time-out mN2Linux联盟 mN2Linux联盟 | "505" ; HTTP Version not supported mN2Linux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|