Home  >  Article  >  Backend Development  >  Get web page files and paths in php_PHP tutorial

Get web page files and paths in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:22:551280browse

php gets the web page file and path

php gets the web page file and path:

echo $_SERVER[’DOCUMENT_ROOT’]."
"; //Get the server document root variable

echo $_SERVER[’PHP_SELF’]."
"; //Variable that obtains the absolute path of the file server that executes the code

echo __FILE__."
"; //Variable to obtain the file system absolute path of the file

echo dirname(__FILE__); //Function to get the folder path where the file is located

php gets the current url:

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/845126.htmlTechArticlephp gets the web page file and path php gets the web page file and path: echo $_SERVER[DOCUMENT_ROOT]. ; //get Server document root variable echo $_SERVER[PHP_SELF]. ; //Get the code to execute...
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