您的位置:首页 > 编程语言 > PHP开发

PHP中$_SERVER参考手册

2010-06-17 09:42 357 查看
$_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关。
$_SERVER['argv'] #传递给该脚本的参数。
$_SERVER['argc'] #包含传递给程序的命令行参数的个数(如果运行在命令行模式)。
$_SERVER['GATEWAY_INTERFACE'] #服务器使用的 CGI 规范的版本。例如,“CGI/1.1”。
$_SERVER['SERVER_NAME'] #当前运行脚本所在服务器主机的名称。
$_SERVER['SERVER_SOFTWARE'] #服务器标识的字串,在响应请求时的头部中给出。
$_SERVER['SERVER_PROTOCOL'] #请求页面时通信协议的名称和版本。例如,“HTTP/1.0”。
$_SERVER['REQUEST_METHOD'] #访问页面时的请求方法。例如:“GET”、“HEAD”,“POST”,“PUT”。
$_SERVER['QUERY_STRING'] #查询(query)的字符串。
$_SERVER['DOCUMENT_ROOT'] #当前运行脚本所在的文档根目录。在服务器配置文件中定义。
$_SERVER['HTTP_ACCEPT'] #当前请求的 Accept: 头部的内容。
$_SERVER['HTTP_ACCEPT_CHARSET'] #当前请求的 Accept-Charset: 头部的内容。例如:“iso-8859-1,*,utf-8”。
$_SERVER['HTTP_ACCEPT_ENCODING'] #当前请求的 Accept-Encoding: 头部的内容。例如:“gzip”。
$_SERVER['HTTP_ACCEPT_LANGUAGE']#当前请求的 Accept-Language: 头部的内容。例如:“en”。
$_SERVER['HTTP_CONNECTION'] #当前请求的 Connection: 头部的内容。例如:“Keep-Alive”。
$_SERVER['HTTP_HOST'] #当前请求的 Host: 头部的内容。
$_SERVER['HTTP_REFERER'] #链接到当前页面的前一页面的 URL 地址。
$_SERVER['HTTP_USER_AGENT'] #当前请求的 User_Agent: 头部的内容。
$_SERVER['REMOTE_ADDR'] #正在浏览当前页面用户的 IP 地址。
$_SERVER['REMOTE_HOST'] #正在浏览当前页面用户的主机名。
$_SERVER['REMOTE_PORT'] #用户连接到服务器时所使用的端口。
$_SERVER['SCRIPT_FILENAME'] #当前执行脚本的绝对路径名。
$_SERVER['SERVER_ADMIN'] #管理员信息
$_SERVER['SERVER_PORT'] #服务器所使用的端口
$_SERVER['SERVER_SIGNATURE'] #包含服务器版本和虚拟主机名的字符串。
$_SERVER['PATH_TRANSLATED'] #当前脚本所在文件系统(不是文档根目录)的基本路径。
$_SERVER['SCRIPT_NAME'] #包含当前脚本的路径。这在页面需要指向自己时非常有用。
$_SERVER['REQUEST_URI'] #访问此页面所需的 URI。例如,“/index.html”。
$_SERVER['PHP_AUTH_USER'] #当 PHP 运行在 Apache 模块方式下,并且正在使用 HTTP 认证功能,这个变量便是用户输入的用户名。
$_SERVER['PHP_AUTH_PW'] #当 PHP 运行在 Apache 模块方式下,并且正在使用 HTTP 认证功能,这个变量便是用户输入的密码。
$_SERVER['AUTH_TYPE'] #当 PHP 运行在 Apache 模块方式下,并且正在使用 HTTP 认证功能,这个变量便是认证的类型。

$_SERVER

$HTTP_SERVER_VARS [deprecated]

$_SERVER -- $HTTP_SERVER_VARS [deprecated] — Server and execution environment informationReport a bug



Description

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI 1.1 specification, so you should be able to expect those.
$HTTP_SERVER_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_SERVER_VARS and $_SERVER are different variables and that PHP handles them as such) Report a bug



Indices

You may or may not find any of the following elements in $_SERVER. Note that few, if any, of these will be available (or indeed have any meaning) if running PHP on the command line.

'PHP_SELF' The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available. 'argv' Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. 'argc' Contains the number of command line parameters passed to the script (if run on the command line). 'GATEWAY_INTERFACE' What revision of the CGI specification the server is using; i.e. 'CGI/1.1'. 'SERVER_ADDR' The IP address of the server under which the current script is executing. 'SERVER_NAME' The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host. 'SERVER_SOFTWARE' Server identification string, given in the headers when responding to requests. 'SERVER_PROTOCOL' Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0'; 'REQUEST_METHOD' Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'. Note: PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD.'REQUEST_TIME' The timestamp of the start of the request. Available since PHP 5.1.0. 'QUERY_STRING' The query string, if any, via which the page was accessed. 'DOCUMENT_ROOT' The document root directory under which the current script is executing, as defined in the server's configuration file. 'HTTP_ACCEPT' Contents of the Accept: header from the current request, if there is one. 'HTTP_ACCEPT_CHARSET' Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'. 'HTTP_ACCEPT_ENCODING' Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'. 'HTTP_ACCEPT_LANGUAGE' Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'. 'HTTP_CONNECTION' Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'. 'HTTP_HOST' Contents of the Host: header from the current request, if there is one. 'HTTP_REFERER' The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. 'HTTP_USER_AGENT' Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent. 'HTTPS' Set to a non-empty value if the script was queried through the HTTPS protocol. Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol. 'REMOTE_ADDR' The IP address from which the user is viewing the current page. 'REMOTE_HOST' The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user. Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr(). 'REMOTE_PORT' The port being used on the user's machine to communicate with the web server. 'SCRIPT_FILENAME'
The absolute pathname of the currently executing script. Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user. 'SERVER_ADMIN' The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. 'SERVER_PORT' The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. 'SERVER_SIGNATURE' String containing the server version and virtual host name which are added to server-generated pages, if enabled. 'PATH_TRANSLATED' Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined. Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO. 'SCRIPT_NAME' Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. 'REQUEST_URI' The URI which was given in order to access this page; for instance, '/index.html'. 'PHP_AUTH_DIGEST' When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation). 'PHP_AUTH_USER' When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. 'PHP_AUTH_PW' When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user. 'AUTH_TYPE' When running under Apache as module doing HTTP authenticated this variable is set to the authentication type. 'PATH_INFO' Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO'] would contain /some/stuff. 'ORIG_PATH_INFO' Original version of 'PATH_INFO' before processed by PHP. ----get<?php
echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!';
?>

$_FILES

$HTTP_POST_FILES [deprecated]

$_FILES -- $HTTP_POST_FILES [deprecated] — HTTP File Upload variablesReport a bug



Description

An associative array of items uploaded to the current script via the HTTP POST method.
$HTTP_POST_FILES contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_FILES and $_FILES are different variables and that PHP handles them as such) Report a bug



Changelog

[thead]
[/thead]
VersionDescription
4.1.0Introduced $_FILES that deprecated $HTTP_POST_FILES.
Report a bug



Notes

Note: This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do global $variable; to access it within functions or methods.Report a bug



See Also

move_uploaded_file() - Moves an uploaded file to a new locationHandling File Uploads $_REQUEST



$_POST
Last updated: Fri, 11 Jun 2010




add a note User Contributed Notes
$_FILES mwgamera at gmail dot com
13-Aug-2009 12:40
To determine whether upload was successful you should check for error being UPLOAD_ERR_OK instead of checking the file size. When nothing is chosen to be uploaded, the key in $_FILES will still be there, but it should have error equal UPLOAD_ERR_NO_FILE.
calurion at gmail dot com
29-Jun-2009 11:51
For some reason when I tried to check if $_FILES['myVarName'] was empty() or !isset() or array_key_exists(), it always came back that the file was indeed in the superglobal, even when nothing was uploaded.

I wonder if this is a result of enctype="multipart/form-data".

Anyways, I solved my issue by checking to make sure that $_FILES['myVarName']['size'] > 0
Sam
22-May-2009 02:08
This is REQUIRED by the xhtml specs.
dewi at dewimorgan dot com
18-Mar-2009 06:35
The format of this array is (assuming your form has two input type=file fields named "file1", "file2", etc):

Array
(
    [file1] => Array
        (
            [name] => MyFile.txt (comes from the browser, so treat as tainted)
            [type] => text/plain  (not sure where it gets this from - assume the browser, so treat as tainted)
            [tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted)
            [error] => UPLOAD_ERR_OK  (= 0)
            [size] => 123   (the size in bytes)
        )

    [file2] => Array
        (
            [name] => MyFile.jpg
            [type] => image/jpeg
            [tmp_name] => /tmp/php/php6hst32
            [error] => UPLOAD_ERR_OK
            [size] => 98174
        )
)

Last I checked (a while ago now admittedly), if you use array parameters in your forms (that is, form names ending in square brackets, like several file fields called "download[file1]", "download[file2]" etc), then the array format becomes... interesting.

Array
(
    [download] => Array
        (
            [name] => Array
                (
                    [file1] => MyFile.txt
                    [file2] => MyFile.jpg
                )

            [type] => Array
                (
                    [file1] => text/plain
                    [file2] => image/jpeg
                )

            [tmp_name] => Array
                (
                    [file1] => /tmp/php/php1h4j1o
                    [file2] => /tmp/php/php6hst32
                )

            [error] => Array
                (
                    [file1] => UPLOAD_ERR_OK
                    [file2] => UPLOAD_ERR_OK
                )

            [size] => Array
                (
                    [file1] => 123
                    [file2] => 98174
                )
        )
)

So you'd need to access the error param of file1 as, eg $_Files['download']['error']['file1']
andrewpunch at bigfoot dot com
17-Jan-2009 08:16
If $_FILES is empty, even when uploading, try adding enctype="multipart/form-data" to the form tag and make sure you have file uploads turned on.

$_REQUEST

$_REQUEST — HTTP Request variablesReport a bug



Description

An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE. Report a bug



Changelog

[thead]
[/thead]
VersionDescription
5.3.0Introduced request_order. This directive affects the contents of $_REQUEST.
4.3.0$_FILES information was removed from $_REQUEST.
4.1.0Introduced $_REQUEST.
Report a bug



Notes

Note: This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do global $variable; to access it within functions or methods.Note: When running on the command line , this will not include the argv and argc entries; these are present in the $_SERVER array .Note: The variables in $_REQUEST are provided to the script via the GET, POST, and COOKIE input mechanisms and therefore could be modified by the remote user and cannot be trusted. The presence and order of variables listed in this array is defined according to the PHP variables_order configuration directive.Report a bug



See Also

import_request_variables() - Import GET/POST/Cookie variables into the global scopeHandling external variablesThe filter extension$_SESSION



$_FILES
Last updated: Fri, 11 Jun 2010




add a note User Contributed Notes
$_REQUEST mike o.
12-Mar-2010 12:31The default php.ini on your system as of in PHP 5.3.0 may exclude cookies from $_REQUEST. The request_order ini directive specifies what goes in the $_REQUEST array; if that does not exist, then the variables_order directive does. Your distribution's php.ini may exclude cookies by default, so beware.
John Galt
07-Dec-2009 01:36
I wrote a function because I found it inconvenient if I needed to change a particular parameter (get) while preserving the others. For example, I want to make a hyperlink on a web page with the URL http://www.example.com/script.php?id=1&blah=blah+blah&page=1 and change the value of "page" to 2 without getting rid of the other parameters. <?php 
function add_or_change_parameter($parameter, $value)
{
$params = array();
$output = "?";
$firstRun = true;
foreach($_GET as $key=>$val)
{
if($key != $parameter)
{
if(!$firstRun)
{
$output .= "&";
}
else
{
$firstRun = false;
}
$output .= $key."=".urlencode($val);
}
}
if(!$firstRun)
$output .= "&";
$output .= $parameter."=".urlencode($value);
return htmlentities($output);
}
?> Now, I can add a hyperlink to the page (http://www.example.com/script.php?id=1&blah=blah+blah&page=1) like this:
<a href="<?php echo add_or_change_parameter("page", "2"); ?>">Click to go to page 2</a> The above code will output
<a href="?id=1&blah=blah+blah&page=2">Click to go to page 2</a> Also, if I was setting "page" to a string rather than just "2", the value would be urlencode()'d.
<a href="<?php echo add_or_change_parameter("page", "banana+split!"); ?>">Click to go to page banana split!</a>
would become
<a href="?id=1&blah=blah+blah&page=banana+split%21">Click to go to page banana split!</a> [EDIT BY danbrown AT php DOT net: Contains a bugfix provided by (theogony AT gmail DOT com), which adds missing `echo` instructions to the HREF tags.]
smjg at iname dot com
13-Aug-2009 10:56
Selecting $_GET or $_POST depending on the request method isn't a general solution, since it's possible for an HTTP request to have both posted content and a query string in the URI.If you want to allow for this possibility, you can use
<?php
$req = array_merge($_GET, $_POST);
?>
or vice versa, depending on which you want to be used in the event of a clash between them.
strata_ranger at hotmail dot com
17-Jul-2008 03:04
Don't forget, because $_REQUEST is a different variable than $_GET and $_POST, it is treated as such in PHP -- modifying $_GET or $_POST elements at runtime will not affect the ellements in $_REQUEST, nor vice versa.e.g:<?php$_GET['foo'] = 'a';
$_POST['bar'] = 'b';
var_dump($_GET); // Element 'foo' is string(1) "a"
var_dump($_POST); // Element 'bar' is string(1) "b"
var_dump($_REQUEST); // Does not contain elements 'foo' or 'bar'?>If you want to evaluate $_GET and $_POST variables by a single token without including $_COOKIE in the mix, use $_SERVER['REQUEST_METHOD'] to identify the method used and set up a switch block accordingly, e.g:<?phpswitch($_SERVER['REQUEST_METHOD'])
{
case 'GET': $the_request = &$_GET; break;
case 'POST': $the_request = &$_POST; break;
.
. // Etc.
.
default:
}
?>

$_SESSION

$HTTP_SESSION_VARS [deprecated]

$_SESSION -- $HTTP_SESSION_VARS [deprecated] — Session variablesReport a bug



Description

An associative array containing session variables available to the current script. See the Session functions documentation for more information on how this is used.
$HTTP_SESSION_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_SESSION_VARS and $_SESSION are different variables and that PHP handles them as such) Report a bug



Changelog

[thead]
[/thead]
VersionDescription
4.1.0Introduced $_SESSION that deprecated $HTTP_SESSION_VARS.
Report a bug



Notes

Note: This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do global $variable; to access it within functions or methods.Report a bug



See Also

session_start() - Initialize session data $_ENV



$_REQUEST
Last updated: Fri, 11 Jun 2010




add a note User Contributed Notes
$_SESSION Dave
17-Nov-2009 10:05
If you deploy php code and cannot control whether register_globals is off, place this snippet in your code to prevent session injections:<?php
if (isset($_REQUEST['_SESSION'])) die("Get lost Muppet!");
?>
charlese at cvs dot com dot au
05-Jul-2009 01:47
I was having troubles with session variables working in some environments and being seriously flaky in others. I was using $_SESSION as an array. It works properly when I used $_SESSION as pointers to arrays. As an example the following code works in some environments and not others.<?php
//Trouble if I treate $form_convert and $_SESSION['form_convert'] as unrelated items
$form_convert=array();
if (isset($_SESSION['form_convert'])){
$form_convert=$_SESSION['form_convert'];
}
}
?>
The following works well.
<?php
if (isset($_SESSION['form_convert'])){
$form_convert = $_SESSION['form_convert'];
}else{
$form_convert = array();
$_SESSION['form_convert']=$form_convert;
}
?>
bohwaz
31-Aug-2008 09:43
Please note that if you have register_globals to On, global variables associated to $_SESSION variables are references, so this may lead to some weird situations.<?phpsession_start();$_SESSION['test'] = 42;
$test = 43;
echo $_SESSION['test'];?>Load the page, OK it displays 42, reload the page... it displays 43.The solution is to do this after each time you do a session_start() :<?phpif (ini_get('register_globals'))
{
foreach ($_SESSION as $key=>$value)
{
if (isset($GLOBALS[$key]))
unset($GLOBALS[$key]);
}
}?>
Steve Clay
17-Aug-2008 01:28
Unlike a real PHP array, $_SESSION keys at the root level must be valid variable names.<?php 
$_SESSION[1][1] = 'cake'; // fails$_SESSION['v1'][1] = 'cake'; // works
?>I imagine this is an internal limitation having to do with the legacy function session_register(), where the registered global var must similarly have a valid name.
jherry at netcourrier dot com
01-Aug-2008 11:16
You may have trouble if you use '|' in the key:$_SESSION["foo|bar"] = "fuzzy";This does not work for me. I think it's because the serialisation of session object is using this char so the server reset your session when it cannot read it.To make it work I replaced '|' by '_'. 





<?php
echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!';
?>


<?php// import config/constantssession_set_cookie_params((time()+$_SITE['session_length']));
session_start();
$sess = session_name();
setcookie($sess, $_COOKIE[$sess], time() + $_SITE['session_length']);// .. rest of the code?>It fails. the session cookie is not stored totally.Instead, doing this would work:<?php// import config/constantssession_set_cookie_params((time()+$_SITE['session_length']));
session_start();
$sess = session_name();
setcookie($sess, session_id(), time() + $_SITE['session_length']);// .. rest of the code?>

$php_errormsg

$php_errormsg — The previous error messageReport a bug



Description

$php_errormsg is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the track_errors configuration option is turned on (it defaults to off). Note: This variable is only available when track_errors is enabled in php.ini. Warning
If a user defined error handler (set_error_handler()) is set $php_errormsg is only set if the error handler returns FALSE Report a bug



Examples

Example #1 $php_errormsg example<?php
@strpos();
echo $php_errormsg;
?>
The above example will output something similar to:
Wrong parameter count for strpos()

$http_response_header

$http_response_header — HTTP response headersReport a bug

Description

The $http_response_header array is similar to the get_headers() function. When using the HTTP wrapper, $http_response_header will be populated with the HTTP response headers. Report a bug

Examples

Example #1 $http_response_header example [code]<?php file_get_contents("http://example.com"); var_dump($http_response_header); ?>
The above example will output something similar to:
array(9) {
  [0]=>
  string(15) "HTTP/1.1 200 OK"
  [1]=>
  string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT"
  [2]=>
  string(29) "Server: Apache/2.2.3 (CentOS)"
  [3]=>
  string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT"
  [4]=>
  string(27) "ETag: "280100-1b6-80bfd280""
  [5]=>
  string(20) "Accept-Ranges: bytes"
  [6]=>
  string(19) "Content-Length: 438"
  [7]=>
  string(17) "Connection: close"
  [8]=>
  string(38) "Content-Type: text/html; charset=UTF-8"
}




add a note User Contributed Notes
$http_response_header imchillindave at hotmail dot com
07-Jun-2010 07:05
Here's a few pointers I've learned about using the $http_response_header variable:1) The value changes with each request made.2) When used in methods/functions, the current value must be passed to the method/function.  
Using $http_response_header directly in the method/function without being assigned a value by a function/method parameter will result in the error message: Notice: Undefined variable: http_response_header3) The array length and value locations in the array may change depending on the server being queried and the response received. I'm not sure if there are any 'absolute' value positions in the array.4) $http_response_header ONLY gets populated using file_get_contents() when using a URL and NOT a local file. This is stated in the description when it mentions the HTTP_wrapper.Example of using $http_response_header in a class.
This example will show how the output changes between the two requests.
<?php
class foo
{
private function header_code( $http_response_header )
{
// Display return header status
echo 'Status: ' . $http_response_header[0];

// Display easy-to-read valid PHP array code
echo '<pre>' . var_export( $http_response_header, true ) . '</pre>';
}

public function test()
{
// Make first request
$req1 = file_get_contents( 'http://www.google.com/' );

// Show header data
$this->header_code( $http_response_header );

// Make second request - ( Will have a 301 return header status )
$req2 = file_get_contents( 'http://google.com' );

// Show header data
$this->header_code( $http_response_header );
}
}
$test = new foo;
$test->test();/* Output:Status: HTTP/1.0 200 OK
array (
0 => 'HTTP/1.0 200 OK',
1 => 'Date: Mon, 07 Jun 2010 18:47:10 GMT',
2 => 'Expires: -1',
3 => 'Cache-Control: private, max-age=0',
4 => 'Content-Type: text/html; charset=ISO-8859-1',
5 => 'Set-Cookie: PREF=ID=410f407bde472198; expires=Wed, 06-Jun-2012 18:47:10 GMT; path=/; domain=.google.com',
6 => 'Server: gws',
7 => 'X-XSS-Protection: 1; mode=block',
8 => 'Alternate-Protocol: 443:npn-spdy/1',
)Status: HTTP/1.0 301 Moved Permanently
array (
0 => 'HTTP/1.0 301 Moved Permanently',
1 => 'Location: http://www.google.com/',
2 => 'Content-Type: text/html; charset=UTF-8',
3 => 'Date: Mon, 07 Jun 2010 18:47:10 GMT',
4 => 'Expires: Wed, 07 Jul 2010 18:47:10 GMT',
5 => 'Cache-Control: public, max-age=2592000',
6 => 'Server: gws',
7 => 'Content-Length: 219',
8 => 'X-XSS-Protection: 1; mode=block',
9 => 'HTTP/1.0 200 OK',
10 => 'Date: Mon, 07 Jun 2010 18:47:10 GMT',
11 => 'Expires: -1',
12 => 'Cache-Control: private, max-age=0',
13 => 'Content-Type: text/html; charset=ISO-8859-1',
14 => 'Set-Cookie: PREF=ID=86ae94efdb5499c2; expires=Wed, 06-Jun-2012 18:47:10 GMT; path=/; domain=.google.com',
15 => 'Server: gws',
16 => 'X-XSS-Protection: 1; mode=block',
17 => 'Alternate-Protocol: 443:npn-spdy/1',
)
*/
?>




[/code]





                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: