PHP obtains the path, name, and server path of the file running before the current period. & lt ;? Phpecho displays the relative path and file name of the script file :. $ _ SERVER [PHP_SELF]. & lt; br & gt; echo display the CGI script
PHP obtains the path, name, and server path of the file running before the current period. & lt ;? Phpecho "shows the relative path and file name of the script file :\"". $ _ SERVER ["PHP_SELF"]. "\" & lt; br & gt; "; echo" display the CGI script
PHP gets the path, name, and server path of the running file before the current period
echo "Displays the relative path and file name of the script file: \" ". $_server[" Php_self "]." \"";echo "Displays the CGI script specification used by the
Php obtains the php server variable in the current url path.
Programming in php to obtain the current url address and server variables mainly uses the following global variables: $ _ server ["query_string"], $ _ server ["request_uri"], $ _
DirName (file) takes the absolute path to the current file, which means that the lookup speed is the fastest compared to the relative path.
PHP constant DirName (file)File: called the PHP Magic Constant, returns the full path and file name of the
Phpdirname (_ FILE _) obtains the absolute path of the current FILE. For example, the current file is placed under (d: www), and the file name is test. php. The test code is as follows :? Phpecho _ FILE __; obtain the absolute address of the current
Php introduction to getting current url path functions and server variables
We will introduce the functions for getting the current url path in php and some server variables in php for your reference.Mainly used: $ _ SERVER ["QUERY_STRING"],
The answer is: when the server uses the php feature (function) to include any file, the source of the file to be included is not strictly filtered, so that it can contain a malicious file, we can construct this malicious file to achieve the evil
Programming in PHP, get the current URL address, and server variables, mainly using the following global variables: $_server["query_string"],$_server["Request_uri"],$_server["Script_name" ],$_server["Php_self"]1,$_server["query_string") Description:
Php code used to obtain the absolute path of the current file
$ Basedir = dirname (_ FILE __);
Echo $ basedir;
// An absolute path of the file will be printed on the page!
?>
You can use
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.