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

php获得网页文件跟路径

WBOY
Release: 2016-06-13 09:28:53
Original
1198 people have browsed it

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’];

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template