文档介绍:PHP获取当前url路径的函数及服务器变量:代码如下:<?phpecho$_SERVER['DOCUMENT_ROOT']."<br>";//获得服务器文档根变量echo$_SERVER['PHP_SELF']."<br>";//获得执行该代码的文件服务器绝对路径的变量echo__FILE__."<br>";//获得文件的文件系统绝对路径的变量echodirname(__FILE__);//获得文件所在的文件夹路径的函数?>//server函数$_SERVER["HTTP_REFERER"]=http://localhost/lianxi/$_SERVER["EPT_LANGUAGE"]=$_SERVER["EPT_ENCODING"]=gzip,deflate$_SERVER["HTTP_USER_AGENT"]=Mozilla/;;;.;.)$_SERVER["HTTP_HOST"]=localhost$_SERVER["HTTP_CONNECTION"]=Keep-Alive$_SERVER["PATH"]=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:monFilesAdobeAGL;C:;C:php;C:phpext$_SERVER["SystemRoot"]=C:WINDOWS$_SERVER["COMSPEC"]=C:$_SERVER["PATHEXT"]=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH$_SERVER["WINDIR"]=C:WINDOWS$_SERVER["SERVER_SIGNATURE"]=Apache/(Win32)PHP/\使用的何服务器$_SERVER["SERVER_SOFTWARE"]=Apache/(Win32)PHP/$_SERVER["SERVER_NAME"]=localhost\服务器名称$_SERVER["SERVER_ADDR"]=$_SERVER["SERVER_PORT"]=80\服务器端口$_SERVER["REMOTE_ADDR"]=$_SERVER["DOCUMENT_ROOT"]=D:/lianxi\网站的主目录$_SERVER["SERVER_ADMIN"]=sss@\安装APACHE时设置的邮箱$_SERVER["SCRIPT_FILENAME"]=D:/lianxi/lianxi/\当前的网页的绝对路径,$_SERVER["REMOTE_PORT"]=1076\远程端口$_SERVER["GATEWAY_INTERFACE"]=CGI/$_SERVER["SERVER_PROTOCOL"]=HTTP/$_SERVER["REQUEST_METHOD"]=GET$_SERVER[