PHP的$_SERVER数组的内容
时间:2006-07-14 来源:cnscn2008
1)vi a.php
2)$php a.php
Array
(
[KDE_MULTIHEAD] => false
[SSH_AGENT_PID] => 2494
[HOSTNAME] => localhost.localdomain
[SHELL] => /bin/bash
[TERM] => xterm
[HISTSIZE] => 1000
[GTK2_RC_FILES] => /etc/gtk-2.0/gtkrc:/root/.gtkrc-2.0:/root/.kde/share/config/gtkrc-2.0
[GTK_RC_FILES] => /etc/gtk/gtkrc:/root/.gtkrc:/root/.kde/share/config/gtkrc
[CVSROOT] => :pserver:[email protected]:/home/cvsroot
[GS_LIB] => /root/.fonts
[WINDOWID] => 37748743
[QTDIR] => /usr/lib/qt-3.3
[QTINC] => /usr/lib/qt-3.3/include
[LC_ALL] => zh_CN
[KDE_FULL_SESSION] => true
[http_proxy] => http://172.16.1.254:8080
[USER] => root
[LS_COLORS] => no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
[SSH_AUTH_SOCK] => /tmp/ssh-CxfWCe2443/agent.2443
[ftp_proxy] => http://172.16.1.254:8080
[KDEDIR] => /usr
[SESSION_MANAGER] => local/localhost.localdomain:/tmp/.ICE-unix/2573
[XDG_CONFIG_DIRS] => /etc/xdg.d/kde:/etc/xdg
[KONSOLE_DCOP] => DCOPRef(konsole-2659,konsole)
[MAIL] => /var/spool/mail/root
[DESKTOP_SESSION] => kde
[PATH] => /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/java/bin
[QT_IM_MODULE] => xim
[GDM_XSERVER_LOCATION] => local
[KONSOLE_DCOP_SESSION] => DCOPRef(konsole-2659,session-1)
[INPUTRC] => /etc/inputrc
[PWD] => /var/www/html
[XMODIFIERS] => @im=SCIM
[KDE_IS_PRELINKED] => 1
[LANG] => zh_CN.GB18030
[GDMSESSION] => kde
[SSH_ASKPASS] => /usr/libexec/openssh/gnome-ssh-askpass
[HOME] => /root
[SHLVL] => 3
[LANGUAGE] => zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en:zh_CN.UTF-8
[XCURSOR_THEME] => default
[LOGNAME] => root
[QTLIB] => /usr/lib/qt-3.3/lib
[CVS_RSH] => ssh
[DBUS_SESSION_BUS_ADDRESS] => unix:abstract=/tmp/dbus-yBK47TyKVK,guid=75edb64409adddb6f8b55e6509a6cb00
[LESSOPEN] => |/usr/bin/lesspipe.sh %s
[DISPLAY] => :0.0
[GTK_IM_MODULE] => scim
[G_BROKEN_FILENAMES] => 1
[COLORTERM] =>
[XAUTHORITY] => /root/.Xauthority
[_] => /usr/bin/php
[OLDPWD] => /root
[PHP_SELF] => a.php
[SCRIPT_NAME] => a.php
[SCRIPT_FILENAME] => a.php
[PATH_TRANSLATED] => a.php
[DOCUMENT_ROOT] =>
[REQUEST_TIME] => 1152855845
[argv] => Array
(
[0] => a.php
)
[argc] => 1
)
3)http://127.0.0.1/a.php
Array
(
[HTTP_HOST] => 127.0.0.1
[HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.8.0.4) Gecko/20060614 Fedora/1.5.0.4-1.2.fc5 Firefox/1.5.0.4 pango-text
[HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[HTTP_ACCEPT_LANGUAGE] => zh-cn,zh;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => gb2312,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 300
[HTTP_CONNECTION] => keep-alive
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin
[SERVER_SIGNATURE] => address>Apache/2.2.2 (Fedora) Server at 127.0.0.1 Port 80address>
[SERVER_SOFTWARE] => Apache/2.2.2 (Fedora)
[SERVER_NAME] => 127.0.0.1
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /var/www/html/a.php
[REMOTE_PORT] => 41441
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /a.php
[SCRIPT_NAME] => /a.php
[PHP_SELF] => /a.php
[REQUEST_TIME] => 1152856127
)
检测是否IE浏览器:
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
{
echo 'You are using Internet Explorer.
';
}
?>
相关阅读 更多 +