in PHP dirname () and __file__ is our constant, this article gives you a detailed introduction dirname () and __file__ constants in the use of some matters, a great interest of friends can enter the reference.
DirName () function
String DirName
The path of _ file _ is the file where the current code is located.
Dirname (_ file _); the directory name at the top of the file is obtained.
Dirname (_ file _); the directory name of the file's layer is obtained.
"../" Is suitable for a simple
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
This time to everyone to bring dirname (file) use case to explain, dirname (file) Use the attention of what, the following is the actual case, together to see.
File indicates that the absolute path of the currently located document includes a file
The dirname (file_) function returns the path where the script is located.
For example, the file b.php contains the following content:
If b.php is referenced by a a.php file require or include in another directory.The contents of the variable
In the forum to read a lot of posts, but found that some people are not very likely to use. Think that the description is not detailed enough to achieve! I'll talk to you again. First, you create a new rss.php file and copy the following code into
__FILE__ indicates that the absolute path to the current file includes the filename, dirname (__file__) represents the absolute path of the current file, and basename (__file__) represents the file name of the current file, DirName (__file__). " /f/"
This article mainly introduces the usage of _ FILE _, dirname, and basename in PHP, and analyzes in detail the usage of _ FILE _, dirname, and basename in the form of an instance, test and compare the built-in function in WordPress
This article
This article mainly introduces the usage of _ FILE _, dirname, and basename in PHP, and analyzes in detail the usage of _ FILE _, dirname, and basename in the form of an instance, I also tested and compared the built-in functions in WordPress. For
This article mainly introduces the usage of _ FILE _, dirname, and basename in PHP, and analyzes in detail the usage of _ FILE _, dirname, and basename in the form of an instance, I also tested and compared the built-in functions in WordPress. For
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.