简体   繁体   English

iis7中的PHP标头问题

[英]php header issues in iis7

i have change the header status in my php file 我已经在我的php文件中更改了标头状态

header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);

this code run in windows server. 此代码在Windows Server中运行。 no issues for inside window server. 窗口服务器内部没有问题。 but not run the out side of window server. 但不要运行窗口服务器的外部。 please help me for this issues... 请帮我解决这个问题...

I'm not entirely sure where you picked up the idea, but if you're going to provide that style of HTTP header, you need to use a specific format as documented on the header manual page : 我不完全确定您是从哪儿提出来的,但是如果要提供这种样式的HTTP标头,则需要使用header手册页上记录特定格式:

header('HTTP/1.0 404 Not Found', true, 404);

In particular, it has to start with 'HTTP/' and then an HTTP version number. 特别是,它必须'HTTP/'开头,然后是HTTP版本号。 1.0 and 1.1 are safe numbers to use. 1.01.1是可以使用的安全数字。

Because you're on IIS, that means you're on FastCGI. 因为您使用的是IIS,所以您使用的是FastCGI。 This means that you must also insert a Status header: 这意味着您还必须插入一个Status标头:

header('HTTP/1.0 404 Not Found', true, 404);
header('Status: 404');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM