2012-10-16 34 views

回答

1

header()函数是你所需要的。

void header (string $string [, bool $replace = true [, int $http_response_code ]])

把它放在右后第一<?php标记为脚本呈现响应输出。

你应该参考http://php.net/manual/en/function.header.php

1

看那header()功能:

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

把那个脚本的任何输出之前。

0

发送您发送任何东西给客户header()之前。一些可能的状态标题如下:

header('HTTP/1.1 200 OK'); 

// Page was not found: 
header('HTTP/1.1 404 Not Found'); 

// Access forbidden: 
header('HTTP/1.1 403 Forbidden'); 

// The page moved permanently should be used for 
// all redrictions, because search engines know 
// what's going on and can easily update their urls. 
header('HTTP/1.1 301 Moved Permanently'); 

// Server error 
header('HTTP/1.1 500 Internal Server Error'); 

// header for telling the browser that the content 
// did not get changed 
header('HTTP/1.1 304 Not Modified');