Home >php教程 >php手册 >php获得网页文件跟路径

php获得网页文件跟路径

WBOY
WBOYOriginal
2016-06-13 09:28:531200browse

php获得网页文件跟路径

   php获得网页文件跟路径:

  echo $_SERVER[’DOCUMENT_ROOT’]."
"; //获得服务器文档根变量

  echo $_SERVER[’PHP_SELF’]."
"; //获得执行该代码的文件服务器绝对路径的变量

  echo __FILE__."
"; //获得文件的文件系统绝对路径的变量

  echo dirname(__FILE__); //获得文件所在的文件夹路径的函数

  php获得当前url:

  $url_this = "http://".$_SERVER [’HTTP_HOST’].$_SERVER[’PHP_SELF’];

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