作者:陈业贵 华为云享专家 51cto(专家博主 明日之星 TOP红人) 阿里云专家博主
文章目录
- 前言
- $_SERVER['PHP_SELF']
- $_SERVER['SERVER_ADDR']
- $_SERVER['SERVER_NAME']
- $_SERVER['SERVER_PROTOCOL']
- $_SERVER['REQUEST_METHOD']
- $_SERVER['DOCUMENT_ROOT']
- $_SERVER['HTTP_ACCEPT_LANGUAGE']
- $_SERVER['SCRIPT_FILENAME']
- $_SERVER['SCRIPT_NAME']
- $_SERVER['REQUEST_URI']
前言
学习学习$_SERVER各个系统函数的解释(图文并茂)
$_SERVER[‘PHP_SELF’]
echo $_SERVER['PHP_SELF'];//当前运行的文件,
$_SERVER[‘SERVER_ADDR’]
echo $_SERVER['SERVER_ADDR'];//本地地址
$_SERVER[‘SERVER_NAME’]
echo $_SERVER['SERVER_NAME'];//所在服务器的主机名,我这个是localhost.ip地址是127.0.0.1
$_SERVER[‘SERVER_PROTOCOL’]
echo $_SERVER['SERVER_PROTOCOL'];//请求页面时HTTP(通信协议)的名称和版本
$_SERVER[‘REQUEST_METHOD’]
echo $_SERVER['REQUEST_METHOD'];//访问页面使用的请求方法。例如“GET”“HEAD”“POST”“PUT”代表的是增删改查,当前的是GET
$_SERVER[‘DOCUMENT_ROOT’]
echo $_SERVER['DOCUMENT_ROOT'];//运行文件的所在目录(绝对路径)
$_SERVER[‘HTTP_ACCEPT_LANGUAGE’]
echo $_SERVER['HTTP_ACCEPT_LANGUAGE'];//当前请求头中 Accept-Language: 项的内容(如果存在)。例如,“en”
$_SERVER[‘SCRIPT_FILENAME’]
echo $_SERVER['SCRIPT_FILENAME'];
$_SERVER[‘SCRIPT_NAME’]
echo $_SERVER['SCRIPT_NAME'];//当前运行的脚本的文件
$_SERVER[‘REQUEST_URI’]
echo $_SERVER['REQUEST_URI'];//URI 用来指定要访问的页面。
来源地址:https://blog.csdn.net/qq_37805832/article/details/127252605