【发布时间】:2014-01-16 07:22:14
【问题描述】:
使用header() 使用 PHP 设置自定义状态码响应时:
header("Status: 404 Not Found");
正确,或者:
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
http 标准是什么?或者,你应该同时设置吗?
【问题讨论】:
-
第二个是正确的。据我所知,第一个不是有效的 http 标头,它将是“HTTP/1.0 404 Page Not Found”您几乎可以将其视为“
” -
@Justin,您的答案已经在 Gould 发布的链接中。
标签: php http-headers http-status-codes