Home >Backend Development >PHP Tutorial >傻傻分不清楚的php脚本途径

傻傻分不清楚的php脚本途径

WBOY
WBOYOriginal
2016-06-13 12:24:15883browse

傻傻分不清楚的php脚本路径

   闲话就不说了,还是直接提出今天的问题,准确的说,对多个相似的 有关当前脚本信息的全局变量常量的区分。

  先贴上代码:

<span style="color: #000000;">php</span><span style="color: #0000ff;">echo</span> <span style="color: #800080;">$_SERVER</span>['PHP_SELF'<span style="color: #000000;">];</span><span style="color: #0000ff;">echo</span> "<hr>"<span style="color: #000000;">;</span><span style="color: #0000ff;">echo</span> <span style="color: #ff00ff;">__FILE__</span><span style="color: #000000;">;</span><span style="color: #0000ff;">echo</span> "<hr>"<span style="color: #000000;">;</span><span style="color: #0000ff;">echo</span> <span style="color: #800080;">$_SERVER</span>['SCRIPT_FILENAME'<span style="color: #000000;">];</span><span style="color: #0000ff;">echo</span> "<hr>"<span style="color: #000000;">;</span><span style="color: #0000ff;">echo</span> <span style="color: #800080;">$_SERVER</span>['REMOTE_ADDR'<span style="color: #000000;">];</span><span style="color: #0000ff;">echo</span> "<hr>"<span style="color: #000000;">;</span><span style="color: #0000ff;">echo</span> <span style="color: #800080;">$_SERVER</span>['QUERY_STRING'<span style="color: #000000;">];</span><span style="color: #0000ff;">echo</span> "<hr>";

  浏览器中的地址为http://localhost/test/test4.php?a=3  localhost为根目录。

  现在一看,原来仔细看过的还真有点丈二和尚摸不着头脑。

      贴出结果,不用多做解释,相信很多人也一目了然了。

 

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