$_SERVER中的信息

下面這個數組是我訪問本地的 http://xx.xxx.com/index.php?a=1&b=2的結果,也是apache傳遞給PHP的數據參數。

其中,比較重要的是REQUEST_URI這個變量,一般被用於確定請求的地址。


array(28) {

  ["HTTP_HOST"]=>
  string(37) "www.xxx.com:8886"
  ["HTTP_CONNECTION"]=>
  string(10) "keep-alive"
  ["HTTP_ACCEPT"]=>
  string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
  ["HTTP_USER_AGENT"]=>
  string(101) "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(17) "gzip,deflate,sdch"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(35) "zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4"
  ["HTTP_ACCEPT_CHARSET"]=>
  string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.3"
  ["HTTP_COOKIE"]=>
  string(2589) "H_PS_PSSID=2239_1953_1449_1945_2202_1788_2249_2260"
  ["PATH"]=>
  string(345) "/home/work/env/php/bin"
  ["SERVER_SIGNATURE"]=>
  string(0) ""
  ["SERVER_SOFTWARE"]=>
  string(6) "Apache"
  ["SERVER_NAME"]=>
  string(32) "www.xxx.com"
  ["SERVER_ADDR"]=>
  string(12) "xx.xx.xx.xx"
  ["SERVER_PORT"]=>
  string(4) "8886"
  ["REMOTE_ADDR"]=>
  string(13) "xx.xx.xx.xx"
  ["DOCUMENT_ROOT"]=>
  string(46) "/home/work/htoc/app"
  ["SERVER_ADMIN"]=>
  string(18) ""
  ["SCRIPT_FILENAME"]=>
  string(56) "/home/work/htoc/app/index.php"
  ["REMOTE_PORT"]=>
  string(5) "53512"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["QUERY_STRING"]=>
  string(8) "&a=1&b=2"
  ["REQUEST_URI"]=>
  string(10) "/?&a=1&b=2"
  ["SCRIPT_NAME"]=>
  string(10) "/index.php"
  ["PHP_SELF"]=>
  string(10) "/index.php"
  ["REQUEST_TIME_FLOAT"]=>
  float(1367570051.582)
  ["REQUEST_TIME"]=>
  int(1367570051)
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章