How PHP obtains the file extension,
There are many similar methods on the Internet, but there are such non-rigorous problems, this article does not analyze each, here only the most correct use of PHP to get the file extension (file suffix name) method.
function Get_extension ($filename) {
The function is used in PHP built-in function pathinfo This function, the following analysis of the meaning and usage of this function:
Definition and usage
The PathInfo () function returns information about the file path in the form of an array.
Grammar
PathInfo (path,options)
Description: PathInfo () returns an associative array containing the path information. array elements include the following values:
[DirName]
[BaseName]
[Extension]
For example:
The above will output the following results :
Array ([dirname] =/testweb [basename] = test.txt [extension] = txt)
The above is for everyone to share the correct use of PHP to get the file extension (file suffix name) method, I hope you like, and apply it.
http://www.bkjia.com/PHPjc/1065569.html www.bkjia.com true http://www.bkjia.com/PHPjc/1065569.html techarticle PHP How to get the extension of the file, there are many similar methods on the Internet, but there are such a serious problem, this article will not be analyzed, here only the most correct benefit ...