【发布时间】:2012-10-27 19:00:59
【问题描述】:
我有一个简单的 PHP 代码,它使用 header 发送 404
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
echo $_SERVER["SERVER_PROTOCOL"];
但是当使用curl 命令并强制1.0 时,它会返回..
curl -0 -v 'http://www.example.com/test.php'
> GET /test.php HTTP/1.0
< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Sat, 27 Oct 2012 08:51:27 GMT
< Content-Type: text/html
< Connection: close
<
* Closing connection #0
HTTP/1.0
如你所见$_SERVER["SERVER_PROTOCOL"] 是 1.0 但标题给我1.1,这是什么原因?
【问题讨论】:
-
@Gordon,当你说它是重复的时候,请仔细阅读。