Home  >  Article  >  Backend Development  >  php中$_SERVER怎么用

php中$_SERVER怎么用

PHPz
PHPzOriginal
2016-06-06 20:51:472201browse

php中$_SERVER怎么用

php中$_SERVER的用法

打开编辑器,在文件中写上注释内容。

#$_SERVER的使用

企业微信截图_15928763474716.png

$_SERVER['PHP_SELF'],这个命令是用来获得服务器的当前执行脚本的文件名

企业微信截图_15928763524958.png

$_SERVER['SERVER_NAME'],这个命令是用来获得服务器的名称。

企业微信截图_15928763573453.png

$_SERVER['HTTP_HOST'],用来获得host头部的名称。

企业微信截图_15928763631830.png

$_SERVER['HTTP_REFERER'],用来引导用户代理到当前页的前一页的地址。

企业微信截图_15928763691799.png

$_SERVER['SCRIPT_FILENAME'],用来获得当前执行脚本的绝对路径。

企业微信截图_15928763732275.png

$_SERVER['SERVER_PORT'],用来获得服务器的端口。

企业微信截图_15928763795039.png

更多相关技术文章,请访问PHP中文网

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn