Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 上次修改的http头上出现500个内部服务器错误(无效字符)_Php_Apache_Caching_Internal Server Error_Last Modified - Fatal编程技术网

Php 上次修改的http头上出现500个内部服务器错误(无效字符)

Php 上次修改的http头上出现500个内部服务器错误(无效字符),php,apache,caching,internal-server-error,last-modified,Php,Apache,Caching,Internal Server Error,Last Modified,我有一个php下载脚本,它发送一个Last-Modifiedhttp头,如下所示: 标题(“上次修改:.gmdate(“D,D M Y H:i:s”)“GMT”); 这在很长一段时间内效果很好。 但现在我尝试在另一个项目中使用该脚本,该标题行在xampp中导致错误500 日志文件显示消息: AH02429: Response header name 'Last Modified' contains invalid characters, aborting request 我可以在谷歌(例如)

我有一个php下载脚本,它发送一个
Last-Modified
http头,如下所示:

标题(“上次修改:.gmdate(“D,D M Y H:i:s”)“GMT”);
这在很长一段时间内效果很好。 但现在我尝试在另一个项目中使用该脚本,该标题行在xampp中导致错误500

日志文件显示消息:

AH02429: Response header name 'Last Modified' contains invalid characters, aborting request
我可以在谷歌(例如)和 甚至文档也喜欢或建议使用相同的格式。 所以我真的很想知道为什么apache/xampp在标题上有问题。

我注意到我的标题名中有一个拼写错误。 关键是,可能旧服务器没有抱怨标题拼写错误,而新服务器会触发
内部服务器错误

正确的行应该是

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

Last Modified
而不是
Last Modified

可能是某些时区或区域设置?否,我将页眉中的行打印为页面输出,它与预期的页眉行完全匹配<代码>上次修改:周一,2020年8月24日08:18:23 GMT
上次修改
上次修改
是两件不同的事情。前者从未有效过。天哪@你说得对,那是一个令人尴尬的打字错误