找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4045|回复: 0

[教程] PHP header函数

[复制链接]
  • 打卡等级:本地老炮

9337

威望

7439

金钱

1万

贡献

管理员

自由的灵魂

积分
107425
主题
5630
回帖
26661
注册时间
2003-4-10
最后登录
2026-10-1
发表于 2009-4-26 16:39:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
PHP header函数

<?PHP
/**
* HTTP Protocol defined status codes
* @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]);
}
?>
不懂就搜!点此搜点拨论坛。如果本坛没有,请尝试点此问AI,或跟帖提问。
发帖前注意看置顶帖。
不定期借助AI对点拨论坛陈年老帖进行挖坟回复,打扰勿怪!
您的提问是对点拨论坛的最大贡献!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|点拨论坛 |网站地图

GMT+8, 2026-10-2 00:45 , Processed in 0.041296 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表