HTTP协议状态码,调用函数时候只需要将$num赋予一个下表中的已知值就直接会返回状态了。
<?PHP 
/** 
* HTTP Protocol defined status codes
* HTTP协议状态码,调用函数时候只需要将$num赋予一个下表中的已知值就直接会返回状态了。
* @param int $num
*/ 
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]); 

?>
@header('HTTP/1.0 404 Not Found');

最新文章

  1. 重学hadoop技术
  2. IntelliJ工程导入
  3. C#读写TxT文件
  4. HDU 1005 Number Sequence
  5. 16.10.18学到的Java知识
  6. ftp列表错误或长城宽带连不上ftp的解决方法
  7. smali语法中文版
  8. 读书笔记——Windows核心编程(15)在应用程序中使用虚拟内存
  9. Ubuntu 12.04 SSH 安装
  10. Oracle oerr使用
  11. JS算法之快排&amp;冒泡
  12. 译:Missing index DMV的 bug可能会使你失去理智---慎重看待缺失索引DMV中的信息
  13. python爬虫如何爬知乎的话题?
  14. How Microservices are Transforming Python Development
  15. Kali Linux &amp; Metasploit Framework
  16. Kali WSL折腾笔记-在Windows10上使用Kali子系统
  17. mac 报错Root chmod operation not permitted on file
  18. 阿里最新热修复Sophix与QQ超级补丁和Tinker的实现与总结
  19. TensorRT 不支持Tensorflow的操作有如下
  20. 每天进步一点点-Java IO操作-Java Serializable(对象序列化)的理解和总结

热门文章

  1. [luoguP1963] [NOI2009]变换序列(二分图最大匹配)
  2. 23we
  3. (C++一本通)最少转弯问题 (经典搜索)
  4. 使用 PHPMailer 发邮件
  5. ExcelHelper类
  6. AC日记——线段树练习5 codevs 4927
  7. 洛谷——P2386 放苹果
  8. Wireshark如何单独导出包的列信息
  9. k8s之存储卷及pvc
  10. 利用adb截屏