The code is as follows
/*** PHP Get path or directory implementation* @link http://www.45it.com*/ Magic variable to get the absolute path of the current fileecho "__file__: ========>". __file__;Echo ''; Magic variable, gets
Method One: First obtain the length of the folder in which the current file is located, and then use substr to intercept the length:
Copy the Code code as follows:
$dirName = str_replace ("\ \", "/", DirName (__file__));$dirNameLength = strlen
code as follows
/** * php Fetch path or directory implementation * @l Ink http://www.45it.com */ //Magic variable, get the absolute path of the current file echo "__file__: ========> ".
: This article mainly introduces php programming notes. if you are interested in PHP tutorials, please refer to them. Three methods for php to obtain POST data
Php image watermarking source code
Php + ajax + json is the simplest example.
Php Chinese
PHP Gets the current directory location method, PHP gets the current
This example describes how PHP obtains the current directory location. Share to everyone for your reference. The specific analysis is as follows:
If you want to get the directory
Php programming notes-three methods for obtaining POST data from small_123 php
Php image watermarking source code
Php + ajax + json is the simplest example.
Php Chinese character to pinyin source code
Php traverses the Directory, generates the md5
How PHP Gets the current directory and relative directories
There are many ways to get a directory in PHP, and here's how to get the current directory and relative directory using PHP to avoid confusing it.
Three ways to get post data from PHP
PHP image plus watermark source code
One of the simplest examples of Php+ajax+json
PHP Chinese Pinyin Source code
PHP iterates through directories, generates MD5 values for each file in the directory, and writes
What is the definition and usage of the PHP chdir () function?
In PHP, the chdir () function is to change the current directory, what it means is to get the current directory, a directory, your current directory is the Www/index directory, when
Gets the current file name, current directory, upper directory
File name test.phpPath + file name (to get/var/www/test/test.php)Echo __file__;File name (to get test.php)Echo basename (__file__);File name with no extension (to get test)Echo
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.