我不能在Perl中设置头文件。
print "Expires: Thu, 08 May 2003 08:37:25 GMT\n\n";
print "Content-Type: text/html; charset=windows-1251\n\n";
print "Vary: Accept-Encoding\n\n";第一个只起作用。然后我有了Content-Type: text/x-perl。怎么啦?
发布于 2015-12-16 15:18:08
我假设您正在使用CGI将web服务器连接到Perl。CGI使用空行将报头与响应正文分开。因为
print "Expires: Thu, 08 May 2003 08:37:25 GMT\n\n";在Expires:标题后打印一个空行,其余的打印语句将被视为正文的一部分,而不是标题。你想要:
print "Expires: Thu, 08 May 2003 08:37:25 GMT\n";
print "Content-Type: text/html; charset=windows-1251\n";
print "Vary: Accept-Encoding\n\n";https://stackoverflow.com/questions/34305765
复制相似问题