$_SERVER[“SERVER_NAME"] 和 $_SERVER[“DOCUMENT_ROOT"] 是否总是针对同一个目录? [英] Does $_SERVER["SERVER_NAME"] and $_SERVER["DOCUMENT_ROOT"] always aim to the same directory?
本文介绍了$_SERVER[“SERVER_NAME"] 和 $_SERVER[“DOCUMENT_ROOT"] 是否总是针对同一个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$_SERVER["SERVER_NAME"];
和 $_SERVER["DOCUMENT_ROOT"];
总是解析到同一个目录吗?有没有他们不会的情况?
Do $_SERVER["SERVER_NAME"];
and $_SERVER["DOCUMENT_ROOT"];
always resolve to the same directory? Is there a scenario where they wouldn't?
澄清一下,我知道这些不是一回事 - 我只是想确定 SERVER_NAME 是否总是映射到 DOCUMENT_ROOT.即,如果遵循它们中的每一个,则将始终到达服务器文件系统上的相同物理位置.
To clarify, I KNOW these are not the same thing- I'm trying to establish only whether SERVER_NAME will always map to the DOCUMENT_ROOT. i.e., if by following each of them, one will always arrive at same physical location on the servers file system.
推荐答案
- SERVER_NAME 是互联网上可行的地址 - stackoverflow.com
- DOCUMENT_ROOT 是当前目录的绝对 URL - 在服务器/data/stackoverflow/...
但是是的,它确实针对同一个目录(每次)
but yes, it DOES aim to the same directory (everytime)
这篇关于$_SERVER[“SERVER_NAME"] 和 $_SERVER[“DOCUMENT_ROOT"] 是否总是针对同一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文