Get web page files and paths in php_PHP tutorial

WBOY
Release: 2016-07-13 10:22:55
Original
1247 people have browsed it

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...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!